fiatjaf / neuron.vim

📝 Manage your Zettelkasten in {n}vim.
MIT License
83 stars 21 forks source link

`gzN` uses selected text as filename for new note. What about random ID? #24

Closed vcavallo closed 4 years ago

vcavallo commented 4 years ago

Using gzN is wildly useful and helps with keeping a smooth flow state while writing and linking. Using the selected text as the note title is very convenient, but using the same for the note filename is problematic. I rely on neruon's unique filename ID to make sure I don't have duplicate filenames and to ensure all zettels have a random ID (rather than some having readable filenames and some having random IDs).

It would be great if there were a configuration option that allowed the user to set whether they want gzN to create a random ID or to use the selected text as the filename (all while keeping the selected text as the title).

Sorry I don't have a PR to add for this. I've never written a line of vimscript, but it seems like an if g:the_option_name around this line https://github.com/fiatjaf/neuron.vim/blob/master/autoload/neuron.vim#L149 would do the trick. If I have free time and the will to learn how to test this properly for backwards-compatibility I may be able to submit a PR in the future.

fiatjaf commented 4 years ago

I agree with you. I'm still using an old version of neuron that generates random IDs for all zettels so I don't have that problem.

But it must be fixed urgently!

fiatjaf commented 4 years ago

Ok, there is a fix now. Please let me know if it helps you.

Also used this opportunity to make neuron.vim generate the new zettels by itself entirely instead of calling neuron new, so now these new zettels aren't saved immediately only after your first :w, so it is easier to change your mind about creating a new zettel with gzn/gzN.

fiatjaf commented 4 years ago

One of the fixes required by https://github.com/fiatjaf/neuron.vim/issues/10.