Skip to content

Commit

Permalink
Don't remember cursor position for commit messages
Browse files Browse the repository at this point in the history
It's not very useful to be dropped into the middle of your diff when
opening a new commit. This change prevents cursor position from being
restored for the `gitcommit` filetype.
  • Loading branch information
derekprior committed Apr 27, 2013
1 parent deb7ee5 commit 5fb4052
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vimrc
Expand Up @@ -30,10 +30,10 @@ augroup vimrcEx
autocmd FileType text setlocal textwidth=78

" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
Expand Down

0 comments on commit 5fb4052

Please sign in to comment.