From 4d9c324cc7d018a65a07810e75b2e6ad61e9af1e Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 19 Jan 2021 16:20:10 +0000 Subject: [PATCH] VIM: Keep selection when using < or > in visual mode When indenting or unindenting a code block, I normally visually select it and use < or >. However, both of these unselect the selection. The mappings make vim also do gv after such an action which re-selects the previous selection. --- .gitmodules | 6 ++++++ nvim/.config/nvim/pack/bundle/opt/ultisnips | 1 + nvim/.config/nvim/pack/bundle/opt/vim-snippets | 1 + nvim/.config/nvim/plugin/mappings.vim | 4 ++++ 4 files changed, 12 insertions(+) create mode 160000 nvim/.config/nvim/pack/bundle/opt/ultisnips create mode 160000 nvim/.config/nvim/pack/bundle/opt/vim-snippets diff --git a/.gitmodules b/.gitmodules index d065ae7b..143fd2ac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -67,3 +67,9 @@ [submodule "nvim/.config/nvim/pack/bundle/opt/firenvim"] path = nvim/.config/nvim/pack/bundle/opt/firenvim url = https://github.com/glacambre/firenvim +[submodule "nvim/.config/nvim/pack/bundle/opt/ultisnips"] + path = nvim/.config/nvim/pack/bundle/opt/ultisnips + url = https://github.com/SirVer/ultisnips +[submodule "nvim/.config/nvim/pack/bundle/opt/vim-snippets"] + path = nvim/.config/nvim/pack/bundle/opt/vim-snippets + url = https://github.com/honza/vim-snippets diff --git a/nvim/.config/nvim/pack/bundle/opt/ultisnips b/nvim/.config/nvim/pack/bundle/opt/ultisnips new file mode 160000 index 00000000..c2709504 --- /dev/null +++ b/nvim/.config/nvim/pack/bundle/opt/ultisnips @@ -0,0 +1 @@ +Subproject commit c270950492d71bac0317d47d42cd0884eefe6490 diff --git a/nvim/.config/nvim/pack/bundle/opt/vim-snippets b/nvim/.config/nvim/pack/bundle/opt/vim-snippets new file mode 160000 index 00000000..0c5114e9 --- /dev/null +++ b/nvim/.config/nvim/pack/bundle/opt/vim-snippets @@ -0,0 +1 @@ +Subproject commit 0c5114e90837eac9af2150406f7821041e7e720b diff --git a/nvim/.config/nvim/plugin/mappings.vim b/nvim/.config/nvim/plugin/mappings.vim index c4e79ba8..aafac9ab 100644 --- a/nvim/.config/nvim/plugin/mappings.vim +++ b/nvim/.config/nvim/plugin/mappings.vim @@ -71,3 +71,7 @@ nnoremap co :!opout % " Makes vim default to "very magic" searching nnoremap / /\v vnoremap / /\v + +" Makes vim re-select visual selection when using < or > +vnoremap < >gv