Vim Tips Wiki
Advertisement

When editing a git commit message (.git/COMMIT_EDITMSG) you often won't start on the first line due to Vim remembering your last position in that file. An easy way to fix this is to add the following line to your vimrc:

autocmd FileType gitcommit call setpos('.', [0, 1, 1, 0])

Alternatively, you can create a file named gitcommit.vim in ~/.vim/ftplugin containing the following line:

call setpos('.', [0, 1, 1, 0])

Comments

Thanks for the tip. We like to keep related information in one place, so I'm wondering how best to handle this tip together with our other two git tips:

Each of the three pages is short, and they could be merged to one tip which may help readers and would certainly be easier to easier to manage. OTOH git is a relatively new topic and each page might grow. At any rate, we will discuss how best to handle the October proposed tips here and I hope Khym Chanur joins in. If you have any thoughts at the moment, please add them below (we avoid tip talk pages). JohnBeckett 03:28, October 24, 2009 (UTC)

Advertisement