3

I have a vim config entry to return to the last position in a file. Is there a way to ignore git commit messages?

autocmd BufReadPost *
 \ if line("'\"") > 0 && line("'\"") <= line("$") |
 \   exe "normal! g`\"" |
 \ endif
Bomgar
  • 553
  • 1
  • 3
  • 13
  • Could [this answer](http://stackoverflow.com/a/10410590/4194289) be what you're looking for? – statox Jul 16 '15 at 08:54

1 Answers1

4

Perhaps like this:

autocmd BufReadPost *
    \ if expand('%:p') !~# '\m/\.git/' && line("'\"") > 0 && line("'\"") <= line("$") |
    \     exe "normal! g`\"" |
    \ endif
lcd047
  • 5,731
  • 2
  • 28
  • 38