Fandom

Vim Tips Wiki

Shebang line automatically generated

Redirected from VimTip880

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 880 Printable Monobook Previous Next

created February 20, 2005 · complexity basic · author Bertram Scharpf · version 6.0


In my Python or Ruby scripts, the first line is always a shebang line. I create it automatically by adding this to my vimrc:

augroup Shebang
  autocmd BufNewFile *.py 0put =\"#!/usr/bin/env python\<nl># -*- coding: iso-8859-15 -*-\<nl>\"|$
  autocmd BufNewFile *.rb 0put =\"#!/usr/bin/env ruby\<nl># -*- coding: None -*-\<nl>\"|$
  autocmd BufNewFile *.tex 0put =\"%&plain\<nl>\"|$
  autocmd BufNewFile *.\(cc\|hh\) 0put =\"//\<nl>// \".expand(\"<afile>:t\").\" -- \<nl>//\<nl>\"|2|start!
augroup END

CommentsEdit

You can also create a skeleton-file for each filetype and read it - see :help template.


Also on Fandom

Random Wiki