vim-clang-refactor


Ⅰ. 插件描述

early attempt to integrate the clang-refactor into vim. based on vim-clang-format

Ⅱ. 基本信息

创建日期:  2014-03-13
使用用户:  1
Github星:  7
插件作者:  realincubus

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'realincubus/vim-clang-refactor'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'realincubus/vim-clang-refactor'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'realincubus/vim-clang-refactor'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/realincubus/vim-clang-refactor

Ⅳ. 文档说明

screen cast of a vi session using clang-refactor

vim-clang-refactor

This is a vim plugin that passes information from vim to clang-refactor clang refactor.
It is based on vim-clang-format.

Installation

clang-refactor

First you have to install clang-refactor.
Read the README of clang-refactor for install instructions.

vim-clang-refactor with a plugin manager

If you are using vundle, add:

Bundle 'realincubus/vim-clang-refactor'

to your .vimrc and issue :BundleInstall

vim-clang refactor by hand

dont know

Usage

Single file

Run the commands
:ClangRefactorPow
:ClangRefactorHypot
:ClangRefactorUnary
...

These transformations will be applied to the whole file.
If you want to limit them to a part of the file, select a block using v and start typing the command.

Something like

:'<,'>ClangRefactorPow

will be in the command line of vim.

Multiple files

There are some commands like Rename that will be automaticaly execute the command on all files that are in the compile_commands.json file. For more information read the clang-refactor README.

Problems

My knowledge about vimscript is very limited.
I just took clang-format and added some code to get it running.
I think one can make it much more easy to use but right now dont have the time to do that.
If someone wants to participate feal free to submit pull requests.

One has to open vim in the same folder where the compile_commands.json file resides.

添加新评论