8

Here is the relevant content of my .vimrc

let g:vimwiki_global_ext=0
let g:vimwiki_list = [{'path': 'C:\Users\<USER>\vimwiki',
                     \ 'syntax': 'markdown', 'ext': '.md'}]

The plugin mapping <leader>ww creates a new file called index.md in C:\Users\<USER>\vimwiki as expected. So I suppose path is correct.

My problem is that :set ft? of the index.md file is always set to vimwiki (filetype=vimwiki). I don't know what settings are wrong here?

Note that vimwiki is in /opt instead of /start.

2 Answers 2

10

This is the expected behavior of the plugin when you create a file in your vimwiki the filetype is set to vimwiki.

If you don't want files created outside of the wiki directory to have this filetype you can follow this issue and add the following line to your .vimrc:

let g:vimwiki_global_ext = 0
4
  • 3
    How to set .md file in wiki directory has filetype mardown?. Because of highlights depend on filetype, if a buffer use markdown syntax but has filetype vimwiki, the highlight is totally incorrect. Jun 20, 2018 at 8:12
  • 2
    @TuyenPham To force the markdown filetype you could use an autocommand like autocmd BufNewFile,BufReadPost /path/to/vimwiki/* set filetype=markdown but I think that might break the plugin. You should try asking your question to the maintainer directly on the plugin's issue tracker
    – statox
    Jun 20, 2018 at 8:55
  • Didn't work: autocmd BufNewFile,BufReadPost C:\Users\<USER>\vimwiki\* set filetype=markdown in vimrc, restart gvim and it's still vimwiki from :set ft?. I already asked in issue tracker but haven't got reply yet. Jun 20, 2018 at 9:45
  • Thanks, I have added this option in my vimrc. Jun 14, 2022 at 8:23
1

I know it's kind of old but if someone still comes here for a solution. My problem was that i wanted to have filetype to markdown so that my lsp formatting could work. Using autocmd will break the plugin. Instead fixed it by setting this:

vim.g.vimwiki_filetypes = { "markdown" }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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