michal-h21 / vim-zettel

VimWiki addon for managing notes according to Zettelkasten method
MIT License
555 stars 72 forks source link

z command breaks with gvim #148

Open blackgeorge-boom opened 4 months ago

blackgeorge-boom commented 4 months ago

In gvim, when I use the z command, the new vimwiki file is not created properly.

For example, using z over the word temp in one file, creates a new file with header:

%tags 
%title temp
%date 2024-04-07 14:02

whereas, the correct would be:

---
title: temp
date: 2024-04-07 14:02
tags: 
---

More often than not it works, but sometimes it stops working and produces the above result.

In vim, this seems to be working fine (although there were random times that this would break as well).

I'm not sure how to debug this, hence opening this issue. I'm using gvim 8.1.2269 and Ubuntu 20.

By the way, thanks for the awesome plugin! Been using it for a few years now. I recently switched to gvim to allow for more cute fonts ;).

michal-h21 commented 3 months ago

@blackgeorge-boom this looks like an issue with configuration, as Vimwiki syntax is used instead of Markdown. Isn't it possible that you use a different configuration in Vim and Gvim? Does the following command list the same directories?

 :echo g:vimwiki_list
blackgeorge-boom commented 3 months ago

echo g:vimwiki_list

@michal-h21 Currently, the issue is gone (and the output of your command lists the same directories for both).

I'll wait a bit (because strangely the issue appears randomly) and try your command again. Otherwise, I'll close the issue. Thank you for your help!

michal-h21 commented 3 months ago

@blackgeorge-boom hope it will not start again, because it seems quite mysterious :)

blackgeorge-boom commented 3 months ago

@michal-h21 It came back :). I can indeed confirm that the output of

:echo g:vimwiki_list

is the same nevertheless.

I also noticed that now when I use g[ from inside the vimwiki diary, to link something from my main wiki, it doesn't generate a relative path to the main wiki, so the path created is invalid (it points inside the diary). Normally, this would work fine. Not sure if this helps as well :/.

EDIT: Saving everything, closing, and re-opening seems to fix this. I'll try to see if this related to a remnant swap file, in case gvim is closed abruptly. Would you have any other debug suggestions?

michal-h21 commented 3 months ago

What should g[ do? I don't know this command and cannot find it in Vimwiki's help.

Anyway, I would try to create a minimal vimrc file, without most packages to test if there aren't any clashes.

blackgeorge-boom commented 3 months ago

What should g[ do? I don't know this command and cannot find it in Vimwiki's help.

Ah, this is from the vim-zettel! Copying from :help vim-zettel

                                                              *Vim-Zettel_[[*
- [[ command in insert mode – create a link to a note. It uses FZF for the
   note searching.

- g[ command for visual selection - create a link to a note, with the selected
  text as a title.
blackgeorge-boom commented 3 months ago

Anyway, I would try to create a minimal vimrc file, without most packages to test if there aren't any clashes.

Hmm I see, I will try that, thank you!

michal-h21 commented 3 months ago

Ah, this is from the vim-zettel! Copying from :help vim-zettel

Ah, I totally forgot about this command! I guess that I've added that on a feature request, because I don't use it myself.