VIM visual shifting Vscode
If you want to keep your selection active while indenting in Visual Studio Code with the Vim extension, you can use the gv
command to reselect the last visual selection. Here are the steps:
- First, make sure you are in Normal mode by pressing
Esc
. - Use the visual selection mode to select the lines you want to indent. Press
v
to start visual selection mode, and move your cursor to select text. - Indent the selected lines by pressing
>
for a right-indent or<
for a left-indent. - After the indentation operation, your selection will be deselected automatically. To reselect the previously selected area, simply press
gv
.
So, to summarize: v
(select lines) -> >
(indent) -> gv
(reselect)
This should enable you to indent your code without losing your selection.