How do I reindent the previous visual selection and keep it selected?
gv=gv
When you are iterating on indentation, repeating selection steps is wasted motion.
visual-mode #visual-mode #indentation #editing #formatting #workflow
29 results for "gv"
gv=gv
When you are iterating on indentation, repeating selection steps is wasted motion.
visual-mode #visual-mode #indentation #editing #formatting #workflow
>gv
Normally, pressing > in visual mode indents the selection but exits visual mode, requiring you to press gv to reselect.
gv
The gv command reselects the exact same area that was last selected in visual mode.
:'<,'>m'>+1
The :m command with the visual range moves selected lines.
:move +1 / :move -2
The :move command relocates lines to a specific position without using delete and paste.
:'<,'>move'>+1 or :'<,'>move'<-2
How it works Vim's :move command lets you relocate lines to a different position.
gvV
gv is well known for reselecting the previous visual area, but pairing it with V is a practical upgrade when your next action needs linewise semantics.
> and <
How it works In visual mode, you can shift selected lines to the right or left using the > and to indent them or or shifts the selected lines one shiftwidth to
:xmap
:vmap applies to both visual mode and select mode, which can silently break snippet plugins (like UltiSnips, LuaSnip) that use select mode to position the curso
v / V / <C-v> (while in visual mode)
When you are already in visual mode and realize you need a different selection type, you do not have to exit and re-enter.
>
In visual mode, pressing > indents all selected lines by one shiftwidth.
v
The v command enters character-wise visual mode, letting you select text one character at a time.
`< and `>
The ` ` marks automatically track the boundaries of the last visual selection.
<C-v>jjI1. <Esc>
Visual block insert can add numbered prefixes to lines.
y (in visual mode)
In visual mode, pressing y yanks (copies) the selected text into the default register.
<C-v>j$A;<Esc>
When lines have varying lengths, a normal visual block selection stops at the shortest line.
<C-v>jjxp
Visual block mode lets you select, cut, and paste rectangular columns of text.
:'<,'>
Vim automatically sets two special marks whenever you make a visual selection: ' (end).
:'<,'>sort
The :'sort command sorts the currently selected lines in visual mode alphabetically.
<C-v> (in visual mode)
Once you are in any visual mode, pressing v, V, or switches to charwise, linewise, or blockwise visual mode respectively — without cancelling the current sele