The following code is inside my .vimrc
and generally restores the last cursor position of a file I opened with vim:
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
I really like this feature and want to leave it turned on, except for one file: When commiting with git, vim gets fired up and I can edit the commit message with it. However the commit message file exists before vim starts (and is prefilled), so vim sees it as an existing file and restores the last cursor position (which is usually not where I would like to start to type).
So is there a possibility to modify the above script to exclude the COMMIT_EDITMSG
file?