_arjun's blog

By _arjun, 14 years ago, In English
Hi,

Can anybody tell me that how can I set my vi so that on opening a X.cpp file with VI it has basic skeleton like(header files, main  function, etc.) prewritten in that?

Tags vi
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
10 years ago, # |
  Vote: I like it +14 Vote: I do not like it

you have to create skeleton file inside ~/.vim/ directory (you can create in any location)

And configure ~/.vimrc file, add lines like this

au BufNewFile *.cpp 0r ~/.vim/cpp.skel | let IndentStyle = "cpp"

cpp.skel is the basic skeleton.