Vim 使用外部程序进行缩进
如果使用外部程序进行格式化,可以使用类似Vim 使用外部程序进行缩进,vim,indentation,Vim,Indentation,如果使用外部程序进行格式化,可以使用类似:%的东西!程序执行格式化。是否可以从常规的=和=序列中使用此映射,以便任何缩进命令调用外部程序?了解如何查找命令和导航内置的:help;它是全面的,并提供了许多提示:help=很快就会回答您的问题: ={motion} Filter {motion} lines through the external program given with the 'equalprg' option. Whe
:%的东西!程序
执行格式化。是否可以从常规的=
和=
序列中使用此映射,以便任何缩进命令调用外部程序?了解如何查找命令和导航内置的: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
中,请参见:help'equalprg'
。