4

I have just downloaded and installed the C-Vim plugin for C/C++ development in Vim.

When I create a new .c file, a header is automatically created from a template - I want the same thing to happen when I create a new .h file.

Instead, I get the following warning (when creating new .h file):

template does not exist

How can I modify the plugin settings so that new .h files also have a template generated for them?

Eric Mathison
  • 1,210
  • 10
  • 16
Homunculus Reticulli
  • 65,167
  • 81
  • 216
  • 341

1 Answers1

3

Add this line to your .vimrc file:

let g:C_SourceCodeExtensions  = 'h cc cp cxx cpp CPP c++ C i ii'

The important part here to notice is the h at the begining of the string. For more information on why this works see :h csupport-comm-frame.

Note: in order to see the help documentation, make sure to run :helptags ~/.vim/doc after installing the plugin. Otherwise the documentation that comes with the plugin will not be installed.

Eric Mathison
  • 1,210
  • 10
  • 16
  • +1 for helping me fix this - adding the line to .vimrc solved it however, I would like to understand what I just did :). When I use the help command you gave, I get: E149: Sorry, no help for csupport-comm-frame. Was that a typo on your part? – Homunculus Reticulli Nov 25 '12 at 00:31
  • No, I don't think there was a typo. Assuming you installed everything in the zip file that came with the plugin, you also need to run `:helptags ~/.vim/doc` to generate all of the help files that came with the plugin. – Eric Mathison Nov 25 '12 at 00:33