zk-org / zk-nvim

Neovim extension for zk
https://github.com/zk-org/zk
GNU General Public License v3.0
503 stars 41 forks source link

feat: backlink should jump to correspondent line in file #86

Closed UnkwUsr closed 1 year ago

UnkwUsr commented 1 year ago

I see there 2 solutions:

  1. Implement it on zk server side and then do apropriate steps on vim plugin side.
  2. Implement it only on vim plugin side.

For second option I did some dirty patch: https://github.com/UnkwUsr/zk-nvim/commit/e10629f031dafc909ba5f494c74cd0468ca7e2c7

mickael-menu commented 1 year ago

I'm not sure this can be easily added to the zk server, as ZkBacklinks uses zk.list down the hood, which has no notion of a target column:line.

Alternatively, you can use LSP references for backlinks, which work with column:line. But of course the UI is not as nice.

map('n', '<leader>zb', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
UnkwUsr commented 1 year ago

@mickael-menu Can you reopen it please? I'm staying with my custom solution and it works flawlessly for me (idk, maybe I'm not using some features that this can break, as I see that my modified function is part of api).

I think this feature can be very useful for other users if they see this issue and give it a try, and so then things also may go forward.

Or, maybe I should open draft pull req with temporary solution?