vim中的多个自动命令

前端之家收集整理的这篇文章主要介绍了vim中的多个自动命令前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在.vimrc中有一些部分,看起来像这样: @H_404_1@autocmd Filetype ruby setlocal ts=2 autocmd Filetype ruby setlocal sts=2 autocmd Filetype ruby setlocal sw=2

现在看来我可以把它们转换为:

@H_404_1@autocmd Filetype ruby setlocal ts=2 sts=2 sw=2

但这里是我的问题:有一个vim方式有这样的结构吗?

@H_404_1@<something mentioning Filetype ruby> setlocal ts=2 setlocal sts=2 ... <end>

即,可以使用autocmd Filetype位以某种方式解决一组操作? (这是一个简单的例子,我真的要求更复杂的情况。)

你可以调用一个函数,如果你喜欢: @H_404_1@autocmd Filetype ruby call SetRubyOptions() function SetRubyOptions() setlocal ts=2 ... endfunction

猜你在找的Bash相关文章