oberblastmeister / neuron.nvim

Make neovim the best note taking application
MIT License
398 stars 34 forks source link

shortcut for placing ID inside brackets #33

Open vod3 opened 3 years ago

vod3 commented 3 years ago

hi there,

I have a idea for easier linking between documents. instead of using 'gzZ', which is only placing the ID of the telescope result into vim, it would be nice to place them automaticly inside brackets, like so: [[ DOCUMENT ID ]]

one way to achieve this could be a custom mapping, but my vim/lua scripting skills are near zero:

map(
      "i",
      "[[",
      "[[ <cmd> lua require 'neuron/telescope'.find_zettels {insert=true} <CR> ]] "
)

this command does not work properly, it adds the ID after the closing brackets, maybe someone could help out with this? It would be a nice addition in the README

Thanks!

SiasMey commented 3 years ago

Its real ugly, but I use this... VimL since im still using that for keybinds

inoremap [[]]lua require'neuron/telescope'.find_zettels {insert = true}

Maps Ctrl-l during insert mode to [[ID of selected note]]

So, basically, because they go async, I think the telescope mappings end up happening after other stuff. In my case, I set up [[]] and then left arrow one past the middle, since te search insert for zettels inserts them 1 character past where the search starts.

Odly, the tag search does not act the same way.