new neuron.vim plugin - Neuron

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

fiatjaf

I found some things half-broken and other things I disagreed with in neuron.vim, so I forked it and made my own: https://github.com/fiatjaf/neuron.vim

馃摑 Manage your Zettelkasten in {n}vim. Contribute to fiatjaf/neuron.vim development by creating an account on GitHub.
fiatjaf

there's a list of differences from the original plugin here: https://github.com/fiatjaf/neuron.vim#differences-from-ihsanturkneuronvim, maybe more will come as soon as I learn this vimscript thing better

馃摑 Manage your Zettelkasten in {n}vim. Contribute to fiatjaf/neuron.vim development by creating an account on GitHub.
fiatjaf

Differences from ihsanturk/neuron.vim

  1. Recognize and insert links using the new [[[...]]] syntax instead of <...>;
  2. Replace : with - in zettel titles search view so vim/fzf don't break these;
  3. gzi/gzl insert at the cursor, not in their own line followed by a newline;
  4. gzl doesn't start a new zettel in insert mode, start in normal mode;
  5. gzu/gzl go back to the previously visited zettel instead of the previously edited zettel.
Sridhar Ratnakumar

Looks like ihsanturk is busy with something else. Perhaps he would be interested in a merge later? If not, it might be wise to rename your plugin.

In any case, I'll mention your fork in the official docs.

Sridhar Ratnakumar

@fiatjaf The plugin doesn't support custom zettelkasten directories (by finding neuron.dhall)?

Sridhar Ratnakumar

I suppose the original plugin never supported that either.

fiatjaf

no, it doesn't support custom directories, I didn't change that. I didn't even know it used a fixed directory, I thought it used the current directory. it worked for me automatically because my directory had the correct name by coincidence.

fiatjaf

would it be better if it used the current directory always?

fiatjaf

thank you for mentioning, I'll see if he is interested in merging

Sridhar Ratnakumar

the emacs neuron-mode plugin looks for neuron.dhall starting from the directory of the open .md file, and then uses that. that's the right approach. i think neuron.vim supports only the default zettelkasten.

Sridhar Ratnakumar

btw, while you are here - gzi inserts [[...]]? If so, can gzI (caps) be made to insert folgezettel link [[[..]]]?

Sridhar Ratnakumar

i generally think [[..]] should be the default.

fiatjaf

what if there's no neuron.dhall? I didn't have that file and my site worked fine, only much later I learned about it

fiatjaf

your second request is here: https://github.com/fiatjaf/neuron.vim/commit/d2fb9b387abcf279d0daf096254ca9230ad9b57a

plus some small refactorings. also I didn't bother to create new commands for the insert-as-folgezettel functions as their name would be so huge anyway, so I created just the shortcut directly...
Sridhar Ratnakumar

then you fallback to the default, ~/zettelkasten

fiatjaf

right, that makes sense

fiatjaf

ok, I'm implementing that, but there are two things:

  1. neuron new always creates a file in ~/zettelkasten, it doesn't matter in which directory I am or if it has a neuron.dhall file
  2. shouldn't we just use the directory in which the file being edited is located? there's no need for the recursion into higher directories. if the file being edited is in /home/whatever/super/zettel/page/, use that, if it is in /home/xyz/bananas/, use that -- a zettelkasten is never going to be on a different directory than where a zettel is -- or am I wrong?
Sridhar Ratnakumar

neuron -d /path/to/zk new ... until we do https://github.com/srid/neuron/issues/161

Following suggestions for the user-interface Switch program name from neuron to zk for faster typing Have a default Zettelkasten directory per project e.g. .zk/ Use per default the Zettelkasten (.z...
Sridhar Ratnakumar

i think it would be nice if gzz sorted zettels by date - so recently created zettels can be opened easily.

fiatjaf

may I ask why not just use the current directory always for all neuron things?

Sridhar Ratnakumar

fiatjaf said:

may I ask why not just use the current directory always for all neuron things?

never thought about it, but it looks like a good idea. so what about ~/zettelkasten?

fiatjaf

as I said, I didn't even know there was such a hardcoded default. by first instinct when I installed neuron was: create a directory (which was coincidentally named ~/zettelkasten), move into it and start creating zettels inside.

fiatjaf

since subdirectories are not supported there's no way the policy of just-use-the-current-directory will fail or cause confusion

fiatjaf

actually it was far more confusing to me when I tried to create zettels on a different directory just to test the vim plugin and only after creating 4 I realized they were all in my default zettelkasten

fiatjaf

so what about ~/zettelkasten?

in my opinion it should be trashed out of code, but I don't know about backwards-compatibility etc.

Sridhar Ratnakumar

@fiatjaf That makes sense. I wouldn't worry about backwards compat here. I'm all for switching to current-directory entirely. And just don't have a default. BUT ... I think neuron should fail if there is no neuron.dhall (you just don't want to cd ~/code/someproj and then run neuron by mistake and it treating it as zettelksaten with just README.md in it)

Sridhar Ratnakumar

So in a way, neuron.dhall :: neuron == .git :: git

Sridhar Ratnakumar

https://github.com/srid/neuron/issues/161#issuecomment-689880375

Following suggestions for the user-interface Switch program name from neuron to zk for faster typing Have a default Zettelkasten directory per project e.g. .zk/ Use per default the Zettelkasten (.z...
fiatjaf

sorting by date is here: https://github.com/fiatjaf/neuron.vim/commit/6e0ba21985f51a52dd1c30cec0c04039a778d5a1

馃摑 Manage your Zettelkasten in {n}vim. Contribute to fiatjaf/neuron.vim development by creating an account on GitHub.