I have the following autocmd in my vimrc.
augroup line_return
au!
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ execute 'normal! g`"zvzz' |
\ endif
augroup END
It moves the cursor to the line it was on when the file was previously opened.
I like this behaviour generally, but I don't want this behaviour when writing a Git commit. I tried adding the following autocmd, but it doesn't seem to work. I don't think the syntax is wrong since I see no errors when starting Vim. I think it's because it runs before the first autocmd runs, but I'm not sure.
augroup always_start_at_top_of_git_commit
au!
au FileType gitcommit execute 'normal! gg'
augroup END
How can I make this work? Should I actually just add a conditional to the first autocmd instead?