comparison runtime/defaults.vim @ 11512:d32a62babf5f v8.0.0639

patch 8.0.0639: the cursor position is set when editing a new commit message commit https://github.com/vim/vim/commit/9a48961d8bd7ffea14330b9b0181a6cdbe9288f7 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 13 16:12:51 2017 +0200 patch 8.0.0639: the cursor position is set when editing a new commit message Problem: The cursor position is set to the last position in a new commit message. Solution: Don't set the position if the filetype matches "commit". (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Tue, 13 Jun 2017 16:15:03 +0200
parents 2c2b7f486fb0
children fe57e4f0eac1
comparison
equal deleted inserted replaced
11511:d0ec98a59c07 11512:d32a62babf5f
1 " The default vimrc file. 1 " The default vimrc file.
2 " 2 "
3 " Maintainer: Bram Moolenaar <Bram@vim.org> 3 " Maintainer: Bram Moolenaar <Bram@vim.org>
4 " Last change: 2017 Apr 12 4 " Last change: 2017 Jun 13
5 " 5 "
6 " This is loaded if no vimrc file was found. 6 " This is loaded if no vimrc file was found.
7 " Except when Vim is run with "-u NONE" or "-C". 7 " Except when Vim is run with "-u NONE" or "-C".
8 " Individual settings can be reverted with ":set option&". 8 " Individual settings can be reverted with ":set option&".
9 " Other commands can be reverted as mentioned below. 9 " Other commands can be reverted as mentioned below.
104 " ":augroup vimStartup | au! | augroup END" 104 " ":augroup vimStartup | au! | augroup END"
105 augroup vimStartup 105 augroup vimStartup
106 au! 106 au!
107 107
108 " When editing a file, always jump to the last known cursor position. 108 " When editing a file, always jump to the last known cursor position.
109 " Don't do it when the position is invalid or when inside an event handler 109 " Don't do it when the position is invalid, when inside an event handler
110 " (happens when dropping a file on gvim). 110 " (happens when dropping a file on gvim) and for a commit message (it's
111 " likely a different one than last time).
111 autocmd BufReadPost * 112 autocmd BufReadPost *
112 \ if line("'\"") >= 1 && line("'\"") <= line("$") | 113 \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
113 \ exe "normal! g`\"" | 114 \ | exe "normal! g`\""
114 \ endif 115 \ | endif
115 116
116 augroup END 117 augroup END
117 118
118 endif " has("autocmd") 119 endif " has("autocmd")
119 120