Automatic syntax/headers in vim for c++ files

前端 未结 3 1443
南方客
南方客 2021-01-15 23:47

I want that whenever i open a new c++ file in vim in linux ( mandriva 2010 ) the following code gets inserted in it automatically :

Default code :

3条回答
  •  悲哀的现实
    2021-01-16 00:42

    One common method for doing this is described at :help template.

    Another option would be to use a snippets plugin (like snipMate or UltiSnips). These don't automatically insert the code when you open a new file, but you can create various snippets that will expand to portions of the template you describe and let you fill in the portions that vary (like the header in an #include <...> statement).

提交回复
热议问题