vim file type detection error
phpcn_u1582
phpcn_u1582 2017-05-16 16:42:11
0
2
1116

vim turns on file type detection, that is, "filetype on", and turns off vi compatibility, "set nocompatible". According to the documentation:

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.

There are the following entries about markdown in filetype.vim:

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

Explanation README.md will be treated as a markdown file.

But after I opened the markdown file, it was displayed as a vimwiki file (the plug-in vimwiki installed for me), as shown below:

What is the reason for this?

phpcn_u1582
phpcn_u1582

reply all(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

黄舟

Thanks for the invitation... I opened README.md and got the correct result... So my guess is that vimwiki has overwritten vim's default configuration...

Try it in g:vimwiki_list 里面去掉 .md file ..?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!