I've started to use Vimwiki to create a personal wiki. I'm a big fan of the plugin, but unfortunately it hijacks all my Markdown files and sets their filetype to vimwiki.

This is happening with .md and .markdown files.

How can I tell vimwiki to only change the filetype if the file is in the wiki directory I have set?

Here are the vimwiki-related lines from my .vimrc

let s:vimwiki = {}
let s:vimwiki.path = '~/Dropbox/vimwiki'
let s:vimwiki.ext = '.wiki'
let s:vimwiki.syntax = 'default'
let s:vimwiki.diary_rel_path = 'journal/'
let s:vimwiki.diary_index = 'index'
let s:vimwiki.diary_header = 'Journal'
let s:vimwiki.diary_sort = 'asc'
let s:vimwiki.ext2syntax = {'.wiki': 'default'}
let g:vimwiki_list = [s:vimwiki]

I have also tried varying values for ext2syntax, including none at all and {'.md': 'markdown'}, which I believe is the default, but I have had no luck at all with anything changing. Any .md file is set as ft=vimwiki.


I had the same issue, but Ryan's answer didn't fix it. This issue on the old Google Code page suggests placing this fix in your .vimrc:

let g:vimwiki_global_ext = 0

Now files outside the wiki with the wiki page extension will not have filetype=vimwiki. This allows me to use Markdown (.md) with vimwiki and have the benefits of the vimwiki plugin while not overriding normal Markdown files outside of the wiki.

| improve this answer | |

This can be accomplished by replacing the global vimwiki_ext2syntax variable. Place the following in your .vimrc

let g:vimwiki_ext2syntax = {}
| improve this answer | |
  • Now you can mark your own answer as correct. – echristopherson Oct 30 '12 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.