How to batch indent code in vim
大家讲道理
大家讲道理 2017-05-27 17:44:19
0
5
1029

If multiple lines of code are selected, how to indent the selected code segments at the same time?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(5)
某草草

Select the code,
Press < or add a number 3< to indent forward
Press > or add a number 3> to indent backward

phpcn_u1582

Press the > key to indent the current line
Press the 3 >> key to indent the two lines starting from the current one and after

淡淡烟草味

I usually use =,

  • Indent the current line: just ==

  • Indent a function: Move the cursor to the opening brace or closing brace of a function, press = + shift 5, first press =, then press shift and 5

    at the same time
  • Indent a few lines of code: just number + ==, such as 3==, if there are more lines, press more numbers, such as 100==

  • Indent an entire file of code: Press gg to get to the top of the file, then press =, then simultaneously press shift g

伊谢尔伦

Select multiple lines, then press >(shift + .), it will shrink the length of one tab, and then press . to repeat the indentation operation just now.

左手右手慢动作

Select all, shift+tab

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template