General C++ Settings
UPDATE: Go to http://github.com/derekwyatt/vim-config to get the current version of this stuff.
These settings go into the $VIM/after/ftplugin/cpp.vim file.
You can find the file linked here. You’ll find that it’s heavily commented so you shouldn’t have too much trouble figuring out what’s there and why. Of course you can always use the :help functionality to discover what the Vim-specific settings and commands do.
It contains the following features:
- Proper comment formatting independent of code formatting
- Highlighting of “bad” leading tabs and code that goes beyond 120 columns
- Code that automatically updates CPPUNIT test macros to match the tests you’ve actually written
- Definitions for the FSwitch plugin.
- Mappings to help with some of the usual wants and needs.
- Changes the indent expression so that we ignore
namespaces. I do not appreciate it when Vim decides to add a ‘shiftwidth‘ to my code just because it’s in a namespace.
Download the $VIM/after/ftplugin/cpp.vim file here.
scrooloose:
September 15th, 2011 at 1:16 am
Hey bro, your github link at the top is broken.
I have to see your latest c++ settings! :D
Derek Wyatt:
September 15th, 2011 at 1:57 am
Damn, forgot about that one. Fixed.
Sanjith:
January 12th, 2013 at 8:32 am
Why do you specify to wipe out .vimrc and .vim before installing the plugin…
Derek Wyatt:
January 12th, 2013 at 8:45 am
I don’t believe I do, at least not on this page. I probably do when suggesting that you install my vim-config, but that’s not a plugin; it’s a replacement for ~/.vim and ~/.vimrc, which is why you should wipe them out / move them before doing anything with them.