diff options
-rwxr-xr-x | .vimrc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/.vimrc b/.vimrc index 7039c60..136f313 100755 --- a/.vimrc +++ b/.vimrc @@ -73,7 +73,24 @@ nnoremap <C-s> :w<CR> inoremap <C-s> <C-o>:w<CR> " 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 <buffer> { ?---\+<CR> au FileType yaml nmap <buffer> } /---\+<CR> + +" 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! |