Vim Tips Wiki


1,624pages on
this wiki
Add New Page

Use this page to discuss script 5365 cpp-devel: C++ development

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.


I created this Vimscript (adopted from `kde-devel-vim`) for myself to be a more generic C++ helper script (not so KDE/Qt specific). I want to give full credit to the original authors so I added a header in the script file with the original writeup and a link to the location where I found it.

My main goals for this script when I started modifying the original were to add:

  1. Maintenance free `makeprog` setup which supported "out-of-source-builds".
  2. Maintenance free `tagfile` creation.
  3. Help me stay consistent with my indent/coding style (K&R-ish). The original had some formatting helpers and this was a big shortcut for me.

Functionality provided by this script

  • Automatic brace and parenthesis addition. _Intelligence added to place braces on same line as `if`,`while`,`do`,etc._
  • Automatic space between keyword and paren addition.
  • Quick switching between header and impl file.
  • Intelligent includes additions. EG: Automatic '#include /<string.h/>' statement when cursor is on `std::string` statement.
  • Ability to add "standard" (to be overridden for personal or project stds) comment headers.
  • Change and TODO log entry helpers.
  • (un)comment line toggle. _This feature also works with visual selection as well._
  • Intelligent directory searching to enable "out-of-source-building", like in the use of CMAKE.
  • Generic tab completion for braces, parenthesis and quotes. This feature is only meant for convinces, please use a mechanism like "SnipMate" for better tab completion.
  • Ability to align assignments in surrounding statements.
  • Automatic tagfile write for better project source code navigation.
  • Automatic 'path' setting for 'gf' command navigation.
  • Custom 'Make()' function/command to support better out-of-source-building; this should build the project from any source code file in the project.

How do I get set up? If you don't have a preferred installation method, I recommend installing [pathogen.vim](, and then simply copy and paste:

cd ~/.vim/bundle
git clone
vim -u NONE -c "helptags cpp-devel-vim/doc" -c q

Otherwise you can always download from ( devel-vim/downloads/cpp-devel-vim_v1.0.0.tar.gz) and extract it manually (FYI: the `cpp-devel-vim.vim` file is supposed to be in your vim `plugin` directory).


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki