Vimwiki: Wrong filetype in markdown files from a Jekyll project

Created on 27 Apr 2020  路  4Comments  路  Source: vimwiki/vimwiki

I updated the plugin and now, when I work with my Jekyll files (posts in markdown), Vim is not setting the filetype that should be: liquid.

Steps to reproduce the issue:

  • Usin the branch dev, open a markdown file from a Jekyll project. The filetype should be liquid. Instead, it is vimwiki.

About the Vimwiki version, this was the last commit hash from the branch dev:
1020ac51bf0dec12241e279a5cdb4cdcfdeeaa33

And this is the commit hash I'm using to make it work:
64c9f3d36d632b1657616c06ea8f08f14cf6438d

Most helpful comment

I should note that on dev branch, adding this to .vimrc disables the temporary wiki feature:

let g:vimwiki_global_ext = 0

I hope a proper fix comes in.

All 4 comments

I am having this issue too after an upgrade. vimwiki seems to completely take over any markdown file on my system. Unfortunately I tried using the master branch and the behavior still happens.

On the dev branch I traced it to temporary wikis.

In `plugin/vimwiki.vim line 70 you'll find this code:

" This function is called when Vim opens a new buffer with a known wiki
" extension. Both when the buffer has never been opened in this session and
" when it has.
function! s:setup_new_wiki_buffer() abort
  let wiki_nr = vimwiki#vars#get_bufferlocal('wiki_nr')
  if wiki_nr == -1    " it's not in a known wiki directory
    if vimwiki#vars#get_global('global_ext')
      call s:create_temporary_wiki()
    else
      " the user does not want a temporary wiki, so do nothing
      return
    endif
  endif

The line

    if vimwiki#vars#get_global('global_ext')

returns true so a temporary wiki gets created, which is why your file happens that way.

On the master branch, it's a different issue I can't be bothered to track down.

Disabling temporary wikis restores functionality.

I should note that on dev branch, adding this to .vimrc disables the temporary wiki feature:

let g:vimwiki_global_ext = 0

I hope a proper fix comes in.

@napcs gave the answer which is the "canonical fix":

let g:vimwiki_global_ext = 0

It is not a bug => won't be fixed: If the g:vimwiki_syntax = 'markdown' (in author vimrc) and let g:vimwiki_global_ext = 1 (default), a temporary wiki is created and the file is treated as a vimwiki file which is helpful for some edition auto command map, commands. I use it for table edition. more in :h vimwiki_global_ext.

Thanks @napcs

PS: feel free to comment/reopen.

just a comment...

I was not setting vimwiki_syntax so was using the default vimwiki syntax.
I also did not set vimwiki_global_ext (default 1)

And I had the issue described by the topic starter... pop up after an update, in the past there was no issue.

just adding let g:vimwiki_global_ext = 0 to my vimrc` resolved the issue on my side.

I didn't see this github issue before and commented on https://github.com/vimwiki/vimwiki/issues/927 first as it was still open....

Just wanted to say, this behavior can be confusing for new users though so it might warrant a mention in the github readme?
At least I was also guilty for not RTFM first :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mgdreamingstar picture mgdreamingstar  路  4Comments

chuahou picture chuahou  路  4Comments

lsrdg picture lsrdg  路  5Comments

guakamole picture guakamole  路  3Comments

ashwinvis picture ashwinvis  路  5Comments