michal-h21 / vim-zettel

VimWiki addon for managing notes according to Zettelkasten method
MIT License
557 stars 73 forks source link

ZettelSearch changes file extension #91

Closed folofjc closed 3 years ago

folofjc commented 3 years ago

I cannot tell if this is in ZettelSearch or in fzf, but it appears to be in ZettelSearch.

I have 4 wikis in VimWiki (and I let vim-zettel "work" in all of them by not setting g:zettel_options). In one of them, the syntax is markdown, but the file extension is not .md. I want to use vim-zettel keybindings (specifically, the [[ shortcut to search within the wiki and insert the file as a link).

However, when I search in this wiki using :ZettelSearch, when it inserts the link it strips the original extension and replaces it with .md. I cannot figure out why. I have tried g:vimwiki_markdown_link_ext set to both 0 and 1 and get the same result.

The reason that I think this is in ZettelSearch, is because if I use notational-fzf to search and then <C-y> to yank and paste it, it keeps the original file extension.

folofjc commented 3 years ago

Okay, I think I found the code. In autoload/zettel/fzf.vim line 33 it strips the extension off the link. Then in autoload/zettel/vimwiki.vim line 82 hardcodes to a .md. However, it looks like it should only do this if the g:vimwiki_markdown_link_ext == 1 which is not what I am seeing. I will keep testing.

folofjc commented 3 years ago

Okay, that was a problem in my .vimrc. I was setting the variable twice, so it was getting overwritten. Now everything works as expected! I'll close this.