Suppose I wrote the code, after which I noticed that I forgot to add a condition at the very beginning of the code. To make the code more readable, I certainly want to move the entire code lower by the tab width to the right of the current position. How to do it immediately for all (selected) code?

  • one
    click > (more sign) - aleksandr barakin
  • Thank! What you need) - Andrej Levkovitch

4 answers 4

clicking >> in command mode shifts the current line to the right by the amount defined in the variable shiftwidth .

If you specify a number before this, it will determine the number of lines (starting with the current one) that will be shifted. those. 2 >> moves the current and following lines.


pressing > in visual mode (i.e. with a highlighted block of text) shifts the selected lines to the right by the same amount ( shiftwidth ).

if you specify a number before this, it will determine how many times the shift will be made.

    Use the >> command in normal mode or > during selection.

    For example, calculate how many lines you need to move, and enter that number, then press SHIFT + twice . . Or select this text by pressing SHIFT + V , select the text by moving the cursor, then press SHIFT + > once.

      In addition to the previous answers:

      • More worth mentioning = = - automatic alignment.
      • If for some reason you want other indents, you can select a rectangular block ( CTRL - V ) and then insert spaces manually ( I Space )

        Hey.

        In the piggy bank:

        v i p > - shift the paragraph to the tab, where the paragraph is part of a solid text, separated by empty lines at the top and bottom.

        Links