views:

2903

answers:

7

What are the essential addons to help with editing C?

+11  A: 

cScope plugin

Allows searching code for:

  • all references to a symbol
  • global definitions
  • functions called by a function
  • functions calling a function
  • text string
  • regular expression pattern
  • a file
  • files including a file

Ctags

  • generate tag imformation of sources, for navigating them.

Tag List Plugin

  • Code outline.

Code completion

  • Function parameter completion, code snippets, and much more.
Lucas S.
A: 

Syntax coloring and integrated cscope functionality

Sorry for the nit--is syntax coloring really a plugin?
JXG
+6  A: 

Definitely use a tags file to navigate around the source. The best tool to create one is Exuberant Ctags, at http://ctags.sourceforge.net/. In Vim you can enter ":help tags" to get more information.

andy
+11  A: 

I like the "Alternate" plugin to quickly switch between .c and .h files

Dprado
+8  A: 

I have a suite for C and C++ programming. It is mainly oriented toward C++ programming, however a few, and unique features can be used in C as well:

  • context sensitive snippets (they require other plugins I'm maintaining);
  • a way to jump to a function definition from its declaration (or create it on the fly if it doesn't exists yet) (it requires the plugin alternate, which is a must have);
  • a little tool that lists functions with a declaration and no definition, or functions with a definition and no declaration (NB: I haven't used it against C static function yet) (it requires ctags).

It is a little bit messy to install right now. I still have a few thing to do before an official and correctly packaged release.

Otherwise, I also use:

  • plugins like project/local_vimrc in order to have project specific settings ;
  • searchInRuntime to open/jump to files without the need to browse the directories of the current project ;
  • an unreleased refactoring plugin (that needs refactorisation ...) ;
  • a wrapper around :make in order to do background compiling, and to filter &makeprg results (e.g. pathnames conversions between cygwin posix form and dos form ; application of STLfilt ; etc.) (-> BuildToolWrapper which is stable, but still in an alpha stage) ;
  • and a few other things which have already been mentioned (alternate, ctags, ...).

HTH,

Luc Hermitte
Keep up the good work. We definitely need a "suite" instead of individual scripts.
Luc Hermitte
Keep it up. A refactoring plugin would be awesome.
Imbue
DO you have more info on the BuildToolWrapper? I would like to use it, but there aren't any instructions with it :(
jinxed_coder
Plenty. There is a doc file in the doc/ directory. In order to simplify the definition of local project variables, I use local_vimrc (in the misc directory). I would be easier if you contact me by email. Depending on your need (filter and/or compilation on <f7>) I may give you better indications.
Luc Hermitte
A: 

All off the above and,

I found this little plugin called code_complete really cute, to "tab complete" like you do in the shell but with you code... Watch this demo and you you will get the idea.

And since we use doxygen to document our code I rather easily expanded that script to create a /** @bla bla etc etc */ type off thing that was compatible with out coding standards. (Thinking about it, it is quite close to the javadoc type of comments)

/Johan

Johan
+1  A: 

For code completion I would recommend snippetsEmu. It is very easy to customize.

davitenio