michal-h21 / vim-zettel

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

Running ZettelOpen and ZettelNew as global commands from any buffer #69

Open johangustafsson opened 3 years ago

johangustafsson commented 3 years ago

Hi Michal,

I wish I could run ZettelOpen and ZettelNew as global commands from any buffer. But it seems that, currently, only ZettelCapture and ZettelInsertNote are global commands available from non-VimWiki buffers.

Best, Johan

victorkristof commented 3 years ago

I support this suggestion, I was about to open an issue for this exact same feature :)

That would be a really great thing to have!

michal-h21 commented 3 years ago

I was able to crate :ZettelOpen command as global. I've also added a new command, :ZettelSetActiveWiki. You can select default wiki using this command. It can be useful when you have multiple wikis. It works not only for :ZettelOpen, but also for :ZettelInsertNote.

:ZettelNew failed with error when I tried to move it, I need to investigate more what is the problem.

johangustafsson commented 3 years ago

Thanks. I am still not getting it to work, however. When I try ZettelOpen, it searches fine, but then it opens a file in the directory of my current buffer rather than the Zettelkasten directory.

michal-h21 commented 3 years ago

Really? Do you get any error messages? I've updated the function with some debugging messages, can you copy them from :messages prompt?

johangustafsson commented 3 years ago

From the debug messages, it looks like dir and wikidir are fine; they both point to my Zettelkasten directory:

[DEBUG] filename: 2009230454.md [DEBUG] wikiname: 2009230454 [DEBUG] dir: /Users/johangustafsson/Dropbox/Notes/Zettelkasten/ [DEBUG] wikidir: /Users/johangustafsson/Dropbox/Notes/Zettelkasten/

But I still get a new buffer called "2009230454.md" in the current directory rather than the Zettelkasten directory.