From 13b094154ea6058509f879f54cae42a496a59629 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 14 May 2023 18:28:58 -0300 Subject: vim: start git commits in insert mode (but don't lol) --- .vimrc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.vimrc b/.vimrc index 7039c60..136f313 100755 --- a/.vimrc +++ b/.vimrc @@ -73,7 +73,24 @@ nnoremap :w inoremap :w " restore previous scroll position -autocmd BufReadPost * silent! normal! g`"zv +fun! RestoreScrollPosition() + " always start editing certain files at the top + if &ft =~ 'gitcommit' + return + endif + g`"zv " this is the actual restore-scroll part +endfun +autocmd BufReadPost * silent! normal! :call RestoreScrollPosition() + +" spooky vim backups stolen from official example config +if has("vms") + set nobackup " do not keep a backup file, use versions instead +else + set backup " keep a backup file (restore to previous version) + if has('persistent_undo') + set undofile " keep an undo file (undo changes after closing) + endif +endif " disable default language-specific indentation behavior " (this doesn't actually work as an autocmd, instead copy-paste @@ -161,3 +178,7 @@ autocmd BufEnter,BufNew *.js autocmd CursorMoved,CursorMovedI * :if match(getlin au FileType yaml setlocal indentexpr= au FileType yaml nmap { ?---\+ au FileType yaml nmap } /---\+ + +" start git commits in insert mode (wrong and evil) +" au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG :startinsert! +" au BufNewFile,BufRead NOTES_EDITMSG,EDIT_DESCRIPTION :startinsert! -- cgit 1.3.0-6-gf8a5