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为我安装的插件),如下图:
这个是什么原因呢?
gloom
11 years, 1 month ago
Answers
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:vimwiki ext2syntax = {'.md': 'markdown'}. This setting tells vimwiki to recognize files with a ".md" extension, overriding previous filetype associations. See ":help vimwiki ext2syntax".
NStal
answered 11 years, 1 month ago