From eae61fe67c7df9caf53a00f1070dc9178aa1147b Mon Sep 17 00:00:00 2001 From: surtur Date: Sun, 30 Oct 2022 04:09:01 +0100 Subject: [PATCH] vimrc: tweak save_cursor_position augroup --- .vim/vimrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vim/vimrc b/.vim/vimrc index 85989a4..717ce4d 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -801,8 +801,11 @@ augroup END " when quitting a file, save the cursor position augroup save_cursor_position + if &filetype !~# 'commit\|rebase' autocmd! - autocmd BufReadPost * call setpos(".", getpos("'\"")) + " also automatically open any folds the cursor might land on. + autocmd BufReadPost * silent! normal! g`" zv + endif augroup END " when not running in a console or a terminal that doesn't support 256 colors