vim 文件类型检测错误

vim开启了文件类型检测,即"filetype on",并且关闭了vi兼容,"set nocompatible"。按照文档上说法:

Detail: The ":filetype on" command will load one of these files:
Mac $VIMRUNTIME:filetype.vim
Unix $VIMRUNTIME/filetype.vim
This file is a Vim script that defines autocommands for the
BufNewFile and BufRead events. If the file type is not found by the
name, the file $VIMRUNTIME/scripts.vim is used to detect it from the
contents of the file.

其中filetype.vim里关于markdown有下面条目:

" Markdown
au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md setf markdown

说明README.md将被视为markdown文件。

可是我打开markdown文件后,却显示为vimwiki文件(vimwiki为我安装的插件),如下图:
2013-04-13-10-18-31的屏幕截图.png

这个是什么原因呢?

阅读 6.7k
2 个回答

The easiest solution to this is to change the default setting of the g:vimwiki_ext2syntax variable in your .vimrc (or Janus could make this the default) as follows:

let g:vimwiki_ext2syntax = {}

The default value of g:vimwikiext2syntax = {'.md': 'markdown'}. This setting tells vimwiki to recognize files with a ".md" extension, overriding previous filetype associations. See ":help vimwikiext2syntax".

vimwiki/markdown conflict

谢邀 ... 我打开 README.md 得到的是正确的结果 ... 所以猜测是 vimwiki 覆盖了 vim 的默认配置 ...

g:vimwiki_list 里面去掉 .md 文件试试看 ..?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进