Is there to make Vim create a comment blurb based on the filetype when I open a new file?
I am new to Vim. Here is the functionality I am looking for. When I do:
$ vim hello.py
I want the file to start with:
#Date Created: 24 May 2012
#Last Modified: (This is optional, really)
#Summary: (enter short summary of program here)
#Author: My Name
#License: ...
etc. I have searched around but I cannot find a solution to do this.
You could do this without skeleton files using the following:
autocmd BufNewFile *.py exe "normal O#Date Created: " . strftime("%d %b %Y") . "\r#Last Modified:\r#Summary:\r#Author:\r#License:\r"
autocmd BufWritePre *.py exe "%s/^#Last Modified:.*$/#Last Modified: " . strftime("%d %b %Y (%T)") . "/e"
Put those in your vimrc.
A potential problem is that the autocmd BufWritePre
will append the current time to all lines beginning with:
#Last Modified: