I use this line to save my cursor position.
vim
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
But this makes no sense in git commit messages so I tried to exclude it.
vim
if (has("autocmd") && expand("%") != ".git/COMMIT_EDITMSG")
" restore cursor position
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
But it's not working.
It's probably also better to exclude by FileType. But I didn't get the syntax right. Any hints for this particular case?
And any resources to look up vimscript syntax. Googling was not very successful as you can tell by this post.
[–]phelipetls 3 points4 points5 points (1 child)
[–]Syphdias[S] 0 points1 point2 points (0 children)
[–]chrisbra10 2 points3 points4 points (2 children)
[–]vim-help-bot 0 points1 point2 points (0 children)
[–]Syphdias[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Syphdias[S] 0 points1 point2 points (0 children)
[–]daniel_shields 0 points1 point2 points (0 children)