使用外部程序进行缩进
Using external program for indentation
如果使用外部程序进行格式化,可以使用 :%!program
之类的程序来执行格式化。是否可以从常规 =
和 ==
序列中使用 map this 以便任何缩进命令调用外部程序?
了解如何查找命令和导航内置 :help
;它内容全面,提供了许多技巧。 :help =
会立即回答您的问题:
={motion} Filter {motion} lines through the external program
given with the 'equalprg' option. When the 'equalprg'
option is empty (this is the default), use the
internal formatting function...
所以,答案很简单
:set equalprg=program
你可以把它放在你的 ~/.vimrc
中,或者(如果你只想要某些缓冲区),使用 :setlocal
(选项是全局的或本地的,:help 'equalprg'
告诉你这个) 然后把它放在 ~/.vim/after/{filetype}.vim
.
如果使用外部程序进行格式化,可以使用 :%!program
之类的程序来执行格式化。是否可以从常规 =
和 ==
序列中使用 map this 以便任何缩进命令调用外部程序?
了解如何查找命令和导航内置 :help
;它内容全面,提供了许多技巧。 :help =
会立即回答您的问题:
={motion} Filter {motion} lines through the external program
given with the 'equalprg' option. When the 'equalprg'
option is empty (this is the default), use the
internal formatting function...
所以,答案很简单
:set equalprg=program
你可以把它放在你的 ~/.vimrc
中,或者(如果你只想要某些缓冲区),使用 :setlocal
(选项是全局的或本地的,:help 'equalprg'
告诉你这个) 然后把它放在 ~/.vim/after/{filetype}.vim
.