操作系统:CentOS 5.7
我试图让gVim / Vim都为新文件类型提供语法高亮显示。到目前为止我做了:
~/.vim/ftdetect/foo.vim
创建语法文件。$ vim myfile.foo
我尝试在~/.gvimrc
中添加此行:
au BufRead,BufNewFile *.foo set filetype=foo
但看起来gVim根本没有加载~/.vim/ftdetect/foo.vim
。我该如何配置gVim?
foo.vim
移至~/.vim/syntax/
对两个Vim / gVim都不起作用。他们无法自动检测~/.vim/syntax
文件夹。:set syntax=foo
也无效。:au BufRead,BufNewFile *.foo
没有显示vim / gVim的检测规则。所以Vim神奇地工作...... [VIM:输出scriptnames]
1: /etc/vimrc
2: /usr/share/vim/vim70/syntax/syntax.vim
3: /usr/share/vim/vim70/syntax/synload.vim
4: /usr/share/vim/vim70/syntax/syncolor.vim
5: /usr/share/vim/vim70/filetype.vim
6: /home/myusername/.vim/ftdetect/foo.vim
7: /home/myusername/.vimrc
8: /usr/share/vim/vim70/plugin/getscript.vim
9: /usr/share/vim/vim70/plugin/gzip.vim
10: /usr/share/vim/vim70/plugin/matchparen.vim
11: /usr/share/vim/vim70/plugin/netrwPlugin.vim
12: /usr/share/vim/vim70/plugin/rrhelper.vim
13: /usr/share/vim/vim70/plugin/spellfile.vim
14: /usr/share/vim/vim70/plugin/tarPlugin.vim
15: /usr/share/vim/vim70/plugin/tohtml.vim
16: /usr/share/vim/vim70/plugin/vimballPlugin.vim
17: /usr/share/vim/vim70/plugin/zipPlugin.vim
18: /usr/share/vim/vim70/scripts.vim
[GVIM:scriptnames]
1: /etc/vimrc
2: /usr/share/vim/vim70/syntax/syntax.vim
3: /usr/share/vim/vim70/syntax/synload.vim
4: /usr/share/vim/vim70/syntax/syncolor.vim
5: /usr/share/vim/vim70/filetype.vim
6: /home/myusername/.vim/ftdetect/foo.vim
+ 7: /usr/share/vim/vim70/menu.vim
+ 8: /usr/share/vim/vim70/autoload/paste.vim
9: /home/myusername/.vimrc
10: /usr/share/vim/vim70/plugin/getscript.vim
11: /usr/share/vim/vim70/plugin/gzip.vim
12: /usr/share/vim/vim70/plugin/matchparen.vim
13: /usr/share/vim/vim70/plugin/netrwPlugin.vim
14: /usr/share/vim/vim70/plugin/rrhelper.vim
15: /usr/share/vim/vim70/plugin/spellfile.vim
16: /usr/share/vim/vim70/plugin/tarPlugin.vim
17: /usr/share/vim/vim70/plugin/tohtml.vim
18: /usr/share/vim/vim70/plugin/vimballPlugin.vim
19: /usr/share/vim/vim70/plugin/zipPlugin.vim
+ 20: /home/myusername/.gvimrc
+ 21: /usr/share/vim/vim70/colors/torte.vim
22: /usr/share/vim/vim70/scripts.vim
答案 0 :(得分:3)
对于Vim和gVim来说,加载的内容应该是相同的(除非你在'runtimepath'
中操纵.gvimrc
这样的疯狂事情);您可以使用:scriptnames
检查您的语法检测脚本是否已加载(然后是实际的syntax/foo.vim
语法脚本)。
此外,:au BufRead,BufNewFile *.foo
应列出您的检测规则。
(其他)语法突出显示在gVim中有效吗?!如果没有,那么你就会遇到一般问题。