felko / neuron-mode

An emacs mode for editing Zettelkasten notes with neuron
GNU General Public License v3.0
119 stars 21 forks source link

Link autocomplete by title #21

Closed srid closed 4 years ago

srid commented 4 years ago

Emacs already autocompletes some (if not all?) IDs by default:

image

I don't know the mechanism behind it. It did however make me think it would be really nice if that autocomplete popup displayed the actual title of the zettels. So the user can just type some characters from the title (just as they do in neuron search) of the zettel they want to link to, and Emacs will auto-complete that. It would be a bonus if the user can also directly create and link to a new zettel by typing its title (autocomplete list would be empty, because no existing zettels would match for the new title) and then hitting Enter.


Stealing ideas from Roam:

image

bbuccianti commented 4 years ago

I think you can just use neuron-insert-zettel-link.

felko commented 4 years ago

neuron-insert-zettel-link is good enough for me, but some people might prefer title autocompletion, which doesn't even require the user to type a keybinding. The issue I am encountering when implementing this is that company seems to filter results by prefix only, which isn't really convenient when trying to search a zettel unless you know exactly the title. There might be more sophisticated ways to handle autocomplete (e.g. fuzzy matching) but I haven't found a way to do it yet.

felko commented 4 years ago

Finally implemented in https://github.com/felko/neuron-mode/commit/769a4b99b8390a04c5a55022f416c09a6af67c40, at the cost of adding a dependency on company.