This is for Subversion, but I'm sure you could extend it.
We branch for every feature we add, but I sometimes forget to add branch names to a commit. No longer. Add the following two lines to your
filetype plugin on
au! FileType svn
And create a file named
let cwd = getcwd()
let path = split( cwd, '/' )
let cwd = path[ len(path) - 1 ]
if bufname("%") == "svn-commit.tmp" && cwd != 'trunk'
call append(0, "Branch: " . cwd)
call append(1, "")
call append(2, " - ")
call cursor(3, 4)
Now, when I type 'svn commit', I see something like the following, with the cursor already positioned where it needs to be:
--This line, and those below, will be ignored--
This makes a few assumptions about your environment, so I would love to get some portability comments. I also wanted to leave the editor in insert mode, but couldn't figure out how to do that. Vim is one of the few tools I use regularly for which Google is almost useless.