0

First, I did:

% vim ~/.vim/cvim/c-support/templates/Templates

From there, I changed my User Macros to their desired values. I then saved my changes.

In Vim, I went to Normal Mode and entered:

:!vim test.c

However, my header created with User Macros did not appear at the top of the file. I am using http://www.thegeekstuff.com/2009/01/tutorial-make-vim-as-your-cc-ide-using-cvim-plugin/ as a reference.

Also, here: https://lug.fh-swf.de/vim/vim-c/csupport.html#csupport-templates, section 5.

I put the following into my .vimrc file:

let g:C_Styles = { '.c,.h' : 'C', '.cc,.cpp,.c++,.C,.hh,.h++,*.H' : 'CPP' }

However, this did not work, and my heading is not inserted into my newly created C source files.

I know this is a newbie question, but any help would be greatly appreciated.

2

Discl. I'm maintaining an alternative to c.vim. As such, I don't use it and I don't know its intricacies.

If you've installed c.vim into ~/.vim/cvim and if by % vim ~/.vim/cvim/c-support/templates/Templates you are editing the original files shipped with the plugin, it's probably a bad idea. Indeed, next time you'll update the plugin, you'll lose all your changes. After a quick survey of the source code though, it seems to be the expected way of using it.

Beside, ~/.vim/cvim is a really odd place to install a plugin. Are you sure the plugin is working correctly? Reading your question, I'm not sure this is the case. (This reminds me of this Q/A: Why is the c.vim plugin not working?).

  • According to vim.org/scripts/script.php?script_id=213, I am to copy the zip archive to $HOME/.vim/ and then unzip it there. Is there a better place to unzip it? – jtetra13 May 23 '16 at 14:28
  • @user3410845, If unzip extracts everything in a subdirectory, then you'll want to add this directory to your runtime path option (:h 'rtp'). If the plugin doesn't do/provide anything, then it's likely you either need to change your runtime path option, or to install the plugin directly in ~/.vim without any intermediary directory -- this is not recommended. Otherwise you can also use a plugin manager which will make the installation almost transparent. (For instance, don't even try to use the alternative lh-cpp without any plugin manager) – Luc Hermitte May 23 '16 at 14:58
  • I deleted the plugin and then followed the procedure to copy the zip archive to $HOME/.vim/ and then unzip it there once more, and now it seems to work fine. I don't know why it didn't work before. – jtetra13 May 23 '16 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.