开发者

Indent code in the same way as = in ex mode in Vim

How can I inde开发者_运维知识库nt code in command mode in Vim in the same way as = in visual mode?


Try the normal command == with a range:

{range}normal! ==

It will apply == to each line in the passed range. You can also try things with the gv= command, to reuse last selection; and take a look in the helpful '< and '> marks.


== will fix indentation on a single line
=% will fix indentation to the matching brace (if the cursor is on a brace)
gg=G will go to the top of the file gg and then fix indentation to the bottom of the file =G

summary - = is followed by an movement key and will fix indentation in the range specified by the motion.
This sheet shows the movement key in green, as you can see there are many options

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜