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.
Jonathan Hodgson 4 years ago
parent 15b18a4a0a
commit 4d9c324cc7
  1. 6
      .gitmodules
  2. 1
      nvim/.config/nvim/pack/bundle/opt/ultisnips
  3. 1
      nvim/.config/nvim/pack/bundle/opt/vim-snippets
  4. 4
      nvim/.config/nvim/plugin/mappings.vim

6
.gitmodules vendored

@ -67,3 +67,9 @@
[submodule "nvim/.config/nvim/pack/bundle/opt/firenvim"] [submodule "nvim/.config/nvim/pack/bundle/opt/firenvim"]
path = nvim/.config/nvim/pack/bundle/opt/firenvim path = nvim/.config/nvim/pack/bundle/opt/firenvim
url = https://github.com/glacambre/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

@ -0,0 +1 @@
Subproject commit c270950492d71bac0317d47d42cd0884eefe6490

@ -0,0 +1 @@
Subproject commit 0c5114e90837eac9af2150406f7821041e7e720b

@ -71,3 +71,7 @@ nnoremap <leader>co :!opout <c-r>%<CR><CR>
" Makes vim default to "very magic" searching " Makes vim default to "very magic" searching
nnoremap / /\v nnoremap / /\v
vnoremap / /\v vnoremap / /\v
" Makes vim re-select visual selection when using < or >
vnoremap < <gv
vnoremap > >gv

Loading…
Cancel
Save