auto generate function definition or declaration
- generate the function definitions of class
- generate the static variable definitions of class
- generate the declaration of the function
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
run GenDefinition
in a function or variable declared
run GenDeclaration
in a definition of a function
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;
}