Ⅰ. 插件描述
auto generate function definition or declarationⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'tenfyzhong/vim-gencode-cpp'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'tenfyzhong/vim-gencode-cpp'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'tenfyzhong/vim-gencode-cpp'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/tenfyzhong/vim-gencode-cpp
Ⅳ. 文档说明
# vim-gencode-cpp
auto generate function definition or declaration
Features
- generate the function definitions of class
- generate the static variable definitions of class
- generate the declaration of the function
Install
windows users change all occurrencws of ~/.vim to ~\vimfiles.
- You can choose you preferred bundle manager
- Run the following commans in a terminal:
mkdir -p ~/.vim/bundle
cd ~/.vim/bundle
git clone https://github.com/tenfyzhong/vim-gencode-cpp.git
echo 'set runtimepath^=~/.vim/bundle/vim-gencode-cpp' >> ~/.vimrc Usage
run GenDefinition in a function or variable declared
run GenDeclaration in a definition of a function
Configuration
g:cpp_gencode_function_attach_statement
A list of statement, this will be insert into function body before the function return.
default:
let g:cpp_gencode_function_attach_statement = []sample:
let g:cpp_gencode_function_attach_statement = ['std::cout << "function body"' << std::endl;']it generate definition like this:
int Foo::function()
{
std::cout << "function body" << std::endl;
return 0;
}