From 782accd7ae847ac0aee833c0dcbe66fb9d5ba9ea Mon Sep 17 00:00:00 2001 From: bretello Date: Fri, 25 Mar 2022 08:34:09 +0100 Subject: [PATCH] vim: do not return to previous edit position for files in .git --- vim/vimrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 3340943..5905316 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -84,7 +84,10 @@ if has('persistent_undo') endif " Return to last edit position when opening files (from amix's vimrc) -au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif +au BufReadPost * if ! exists('b:dotgitFolder') | if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif +" set a marker to avoid returning to the previous position in .git folders +" (avoids returning to previous position for COMMIT_EDITMSG etc ) +au BufReadPost */.git/* let b:dotgitFolder = 1 " Bash like keys for the command line cnoremap