Thursday, 13 November 2014

Auto-insert text as a header in VIM


If you want to have headers or some text like '#!/bin/bash' or '#include' embedded when you open a file for C programming or bash, append the following lines in the .vimrc file:
       autocmd BufNewFile *.sh 0read ~/.vim/skeletons/skel_sh
       autocmd BufNewFile *.c 0read ~/.vim/skeletons/skel_c

skel_sh and skel_c will hold all that you want to add when it is a new file with the extension '.sh' or '.c'.

You can use this tip to customize further, as per your requirements.

No comments:

Post a Comment