Improve Esc key reaction, fix gitcommit for vim
dblume

dblume commited on 2024-03-19 10:46:40
Showing 1 changed files, with 3 additions and 2 deletions.


Nvim works as desired without these changes.
Vim seems to have &ft set before BufReadPost, so check gitcommit type
there.
... ...
@@ -14,6 +14,7 @@ set iskeyword+=-    " Add - to list of non-word-breaking chars.
14 14
 set incsearch       " Navigate to matched strings while typing. Toggle: :set is!
15 15
 set scrolloff=0     " EC2 defaults to 5. Set explicitly to be consistent
16 16
 set formatoptions+=j " Delete comment character when joining commented lines.
17
+set ttimeoutlen=100 " Affects Esc key, not leader.
17 18
 
18 19
 if v:version >= 703
19 20
   " Do save the undo tree to file, but not in the local directory.
... ...
@@ -312,10 +313,10 @@ augroup END
312 313
 
313 314
   " When editing a file, always jump to the last cursor position...
314 315
   autocmd BufReadPost *
315
-  \ if line("'\"") > 0 && line ("'\"") <= line("$") |
316
+  \ if &ft != "gitcommit" && line("'\"") > 0 && line ("'\"") <= line("$") |
316 317
   \   exe "normal! g'\"" |
317 318
   \ endif
318
-  " ...except for gitcommit where we always want to start at the top
319
+  " ...except for gitcommit where we always want to start at the top (nvim)
319 320
   autocmd FileType gitcommit exe "normal! gg"
320 321
 
321 322
   autocmd BufNewFile,BufReadPost *
322 323