为什么我的ftplugin,indent,语法文件夹中的配置文件不起作用?

时间:2011-05-24 23:36:13

标签: vim

当我在vim中编辑它时,我希望我的.jade文件有2个空格缩进。我在vim中下载了.jade处理的配置文件,但它们似乎不起作用。所有文件夹都位于/home/name/.vim中,每个文件夹都有jade.vim配置文件。但它们不起作用。我是否需要更改/ home / name中的主.vimrc?

编辑:

autocmd BufRead,BufNewFile *.html setlocal ft=html
autocmd BufRead,BufNewFile *.js setlocal ft=js
autocmd BufRead,BufNewFile *.jade setlocal ft=jade
autocmd BufRead,BufNewFile *.css setlocal ft=css
autocmd FileType html :setlocal sw=2 ts=2 sts=2
autocmd FileType js :setlocal sw=2 ts=2 sts=2
autocmd FileType jade :setlocal sw=2 ts=2 sts=2
autocmd FileType css :setlocal sw=2 ts=2 sts=2

当我使用上面的内容时,我为.js文件的选项卡获取了两个空格。但是,没有语法突出显示(我没有尝试过.html和.css文件,但我认为会发生同样的情况)。我只想覆盖这些文件的选项卡空间,但没有别的。 不过,玉器文件效果很好。现在,jade文件具有语法高亮。

1 个答案:

答案 0 :(得分:3)

如果我不得不猜测,我会说你的.jade文件没有被正确检测到,因此没有设置jade文件类型。尝试在上面的其他autocmds之前在.vimrc中添加以下内容。

autocmd BufRead,BufNewFile *.jade setlocal ft=jade

您还可以通过打开.jade文件并运行:echo &ft来确认我的理论。如果你得到的输出不是jade那么我的理论是正确的。