如何在vim/gvim中缩进多行?

Tan*_*Woo 12 vim shortcut

我想在'vim/gvim'中缩进多行,vim/gvim中有任何快捷方式吗?

Jon*_*oni 18

缩进命令=,<并且>可以结合所有的移动命令和文本对象.例如:

>G     Indent until end of file
>}     Indent until next paragraph
>iB    Indent contents of current { } block
Run Code Online (Sandbox Code Playgroud)

它们还缩进在可视模式下选择的文本.

使用<取消缩进或=重新排版("格式"使用文件类型设置).

  • +1表示`=`选项.虽然通常使用`>`或`<`是理想的,但知道`=`re-indent可用是非常有用的. (2认同)

Bir*_*rei 5

是。尝试:

V             # To switch to visual mode. Select lines, and...
>             # Indent (use `<` to de-indent, or with a number just before to indent several times).
Run Code Online (Sandbox Code Playgroud)