不要在“vim的”问题结尾的文件?否则,vim的文件类型检测可能无法确定这些文件是否包含vim-script。您可以重命名文件,以便以.vim结尾,或者添加自动命令以适当地设置文件类型。
要做到后者,你可以添加这样的事情给你的.vimrc:
au! BufNewFile,BufRead PATTERN set filetype=vim
与将有问题的文件匹配文件模式取代“模式”。
编辑:
的模式是如何工作的,请参阅:help autocmd-patterns
:
The file pattern {pat} is tested for a match against the file name in one of
two ways:
1. When there is no '/' in the pattern, Vim checks for a match against only
the tail part of the file name (without its leading directory path).
2. When there is a '/' in the pattern, Vim checks for a match against the
both short file name (as you typed it) and the full file name (after
expanding it to a full path and resolving symbolic links).
特别要注意这个例子:
Note: To match part of a path, but not from the root directory, use a '*' as
the first character. Example: >
:autocmd BufRead */doc/*.txt set tw=78
This autocommand will for example be executed for "/tmp/doc/xx.txt" and
"/usr/home/piet/doc/yy.txt". The number of directories does not matter here.
你的情况,你可能想是这样的:
au! BufNewFile,BufRead */Vim/* set filetype=vim
上的文件类型插件缩进我将PATTERN设置为* Vim *失败。看起来该命令只考虑文件名。 - 这表明最简单的方法就是将扩展vim添加到每个文件。 – 2009-06-26 22:30:17