Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Indenting a bunch of lines in Vim

Is there a way to indent a selection of lines in Vim, like we have in text editors where we select a bunch of lines and press tab (or shift tab) to indent/unindent the selected lines?

I am talking about general indentation and not related to code indentation.

like image 358
umar Avatar asked Sep 05 '25 12:09

umar


1 Answers

You can select a set of lines with visual line mode (via Shift + V), and then type

>

and, to dedent,

<

You can also add numeric arguments. Find out you didn't indent enough? Hit gv to re-select your previous selection.

While typing in normal mode, try out Ctrl + T or Ctrl + D to indent or dedent.

like image 58
Peter Avatar answered Sep 09 '25 00:09

Peter