michal-h21 / vim-zettel

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

Changing the name of a note should change the filename as well #86

Open thorlucas opened 3 years ago

thorlucas commented 3 years ago

If I have a filename format such as 201129-0158-foobar and title: foobar, if I change the title it should also change the filename. Alternatively, there should be a :ZettelRename command that does that (if polling for changes to the title field is too intensive).

irfansharif commented 3 years ago

I use the two following shorthands to do most of what you're looking for. I didn't try out the polling version, but hopefully you find it useful.

    nmap <Leader>zmv <Plug>VimwikiRenameFile
    nmap <Leader>zrn :let @*=zettel#vimwiki#new_zettel_name(zettel#vimwiki#get_title(expand("%")))<cr>:VimwikiRenameFile<cr>