Closed azic0 closed 11 months ago
Hey there! I'm happy to hear you like Vivify :)
Can you provide some more instructions for how to reproduce the issue? If I edit a markdown file and then run packadd vimwiki
, Vivify's synchronization still works for me.
Thanks for the quick and sorry for the late reply!
Does the synchronisation still work if you reload via :e
after :packadd vimwiki
?
I did modify vivify.vim and vivify.vim somewhat, but not in places that I would think to matter to this problem.
However, if I replace the
autocmd CursorHold,CursorHoldI *
\ if &filetype == 'markdown' | call vivify#sync_content() | endif
autocmd CursorMoved,CursorMovedI *
\ if &filetype == 'markdown' | call vivify#sync_cursor() | endif
in plugin/vivify.vim
with
autocmd CursorHold,CursorHoldI *.md call vivify#sync_content()
autocmd CursorMoved,CursorMovedI *.md call vivify#sync_cursor()
my synchronisation issue is fixed.
Is there a specific reason why you used the former approach and do you think I can expect bad things to happen if I stick to the latter?
Oh, of course, that makes sense! Vimwiki breaks the filetype
: once you have Vimwiki loaded, it will set the filetype
of Markdown files to vimwiki
, i.e. Vim doesn't know anymore that it is a Markdown file. You can check this with :set ft?
.
I can imagine that this breaks other things/plugins as well, so it might be something they should fix.
That being said, the reason I don't use *.md
as you suggested but rather check the filetype
is that there are other file extensions for markdown files, and using *.md
works only with .md
, while Vim's filetype
is much more versatile, increasing compatibility.
My best idea for fixing this would be to introduce an option to vivify.vim that allows users to customize which filetypes should sync, by checking if the &filetype
is in that list in the autocommand's condition.
In your case you could just add vimwiki
then. If you want to implement this, a PR is very welcome; otherwise I'll do it at some point when I find the time :)
Great!
I don't have a lot of experience with vimscript yet, but I will definitely try to implement your solution and send a pull request when I find the time :)
I opened a pull request which should close this issue :) Details can be found in the commit messages.
In short, the issue is closed in two ways. One can set either of
let g:vivify_filetypes = ['vimwiki']
let g:vimwiki_filetypes = ['markdown']
to ensure compatibility between vivify.vim and vimwiki.
Unfortunately I can't seem to link the pull request to this issue, but apart from this, everything is set.
Thanks!
My pleasure!
Hi,
first of all thanks for the plugin, I really like functionality and the lightweight and structured way all of vivify is written.
However, it unfortunately seems to be incompatible with the vimwiki plugin. Whenever I activate it (using vims native plugin manager), the synchronisation ceases to work. After disabling vimwiki's autocommands using
:au! vimwiki
and reloading the buffer using:e
, synchronisation automatically resumes.Do you by any chance know why this could be?
All the best.