From 22ee872d525144f66540bc78e2d6032b570f87ed Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 13 Aug 2019 17:06:27 -0400 Subject: [PATCH] some vim tips from begriffs' vim history post --- Makefile | 3 ++- fzf/.fzf | 2 +- git/.gitconfig | 5 +++++ vim/.vim/bundle/quick-scope | 2 +- vim/.vim/bundle/vim-fugitive | 2 +- vim/.vim/bundle/vim-gitgutter | 2 +- vim/.vim/bundle/vim-surround | 2 +- vim/.vimrc | 21 +++++++++++++++++++++ 8 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 51ca36e..08370b0 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,8 @@ sublime: vim: @printf "$(YELLOW)--- vim ------------------------------------------------\n$(RESET)" - mkdir -p ~/.vim/undodir + mkdir -p ~/.vim/{undodir,swap,backup} + chmod 700 ~/.vim/{undodir,swap,backup} git submodule update --init -- vim/.vim/bundle stow -t "$$HOME" vim diff --git a/fzf/.fzf b/fzf/.fzf index 315e568..5c7dcaf 160000 --- a/fzf/.fzf +++ b/fzf/.fzf @@ -1 +1 @@ -Subproject commit 315e568de006e80138f79c77d5508c7e4853e6b2 +Subproject commit 5c7dcaffe892dad764d0130ee49198646cd8fd73 diff --git a/git/.gitconfig b/git/.gitconfig index 5f218e0..e7a8b2c 100755 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -36,3 +36,8 @@ upstream = log --oneline --no-merges HEAD..${1-$(git branch -lvv | perl -ne '/^\\\\*.*\\\\[(.*?)\\\\]/ and print \"$1\\n\"')} [rerere] enabled = true +[merge] + tool = vimdiff + conflictstyle = diff3 +[mergetool] + prompt = false diff --git a/vim/.vim/bundle/quick-scope b/vim/.vim/bundle/quick-scope index 1002970..994576d 160000 --- a/vim/.vim/bundle/quick-scope +++ b/vim/.vim/bundle/quick-scope @@ -1 +1 @@ -Subproject commit 10029708ee50d300d4b5e3475610210d4b29c74d +Subproject commit 994576d997a52b4c7828149e9f1325d1c4691ae2 diff --git a/vim/.vim/bundle/vim-fugitive b/vim/.vim/bundle/vim-fugitive index bd0b87d..08a9a45 160000 --- a/vim/.vim/bundle/vim-fugitive +++ b/vim/.vim/bundle/vim-fugitive @@ -1 +1 @@ -Subproject commit bd0b87d36ad80e8acd94f22028d15ebb441b1c28 +Subproject commit 08a9a45dbc3cce0af3f246013240d71aa2519ac0 diff --git a/vim/.vim/bundle/vim-gitgutter b/vim/.vim/bundle/vim-gitgutter index 7eeea63..71bbe88 160000 --- a/vim/.vim/bundle/vim-gitgutter +++ b/vim/.vim/bundle/vim-gitgutter @@ -1 +1 @@ -Subproject commit 7eeea63e62b1cc088a75c7a7c244fc774d82e5bb +Subproject commit 71bbe88525c0b36f4f3843a2a577442bbd7fd957 diff --git a/vim/.vim/bundle/vim-surround b/vim/.vim/bundle/vim-surround index 5970688..fab8621 160000 --- a/vim/.vim/bundle/vim-surround +++ b/vim/.vim/bundle/vim-surround @@ -1 +1 @@ -Subproject commit 597068870b8f093a8b2d11536c62ff31222ee8d0 +Subproject commit fab8621670f71637e9960003af28365129b1dfd0 diff --git a/vim/.vimrc b/vim/.vimrc index b2736ac..beef3d9 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -12,6 +12,18 @@ set smarttab set tabstop=4 set shiftwidth=4 set expandtab + +" swap settings +set swapfile +set directory^=~/.vim/swap// +set writebackup +set nobackup +set backupcopy=auto +" patch required to honor double slash +if has("patch-8.1.0251") + " consolidate writebackups + set backupdir^=~/.vim/backup// +end set undofile set undodir=~/.vim/undodir @@ -38,6 +50,15 @@ set tabpagemax=50 noremap 0 ^ noremap ^ 0 +" shortcuts for 3way merge +map 1 :diffget LOCAL +map 2 :diffget BASE +map 3 :diffget REMOTE + +if has("patch-8.1.0360") + set diffopt+=internal,algorithm:patience +end + inoremap u cmap w!! w !sudo tee % >/dev/null