Open mbpowers opened 9 months ago
just use <c-o>
If you navigate around the file in ways that affect the jumplist then you will have to
I thinking binding to Backspace like vimwiki does would be awesome.
I thinking binding to Backspace like vimwiki does would be awesome.
imo this isn't a good keybinding. We won't add certain keybindings just because that's what other tools use you could do this yourself though if such a keymapping would be added
@mbpowers true makes sense. I forgot the keybinding rn but there is something called "alternate file" to which you can instantly hop back. Perhaps that would do what you want. edit: <c-^> is the keybinding
<c-^>
works fine once but then it cycles so if you go A -> B -> C
pressing <c-^>
will go C -> B -> C -> B
.
I personally see it as giving users a way to easily achieve what they might want without having to know the intricacies of neovim bindings and buffers etc. or even if they know it will be repeated work as I think many will want this.
Thoughts on opt-in (could accept a key to bind to)? Or if the concern is it's not worth it to undergo this to add just a single binding, I think it would be nice to add as a note to the hop wiki.
I lose track of buffers as well, not just in neorg but vim in general, so my solution was to customized the hop module so that <CR>
opens links in new tabs, instead of trying to navigate through the invisible list of buffers.
is that already a builtin option? to open the links in tabs? Otherwise I'd be nice if you could open a pr
:bp
and :bun
have unwanted side-effect as expected, I think the best way would be to store the path of the note that you are coming from in the destination note's buffer variables. This could be done when a hop is executed.
I would have to think about this one, more specifically how it would scale with complex jump trees (when you jump between files and links your path isn't always guaranteed to be linear).
It's true that the jumplist isn't informative enough as is. I think what would be more interesting is building up a tree of jumps which one could navigate. Then a simple hop-back
would move up the tree, but we could provide more interesting navigation methods to go along with it.
With the introduction of luarocks we could import a library for rendering trees within Neovim. I believe NUI has something for that, so it might not even be that hard to implement :p
I was actually thinking about this recently. Another option for this would simply be to add to the tagstack every time you do a hop, similar to what the lsp go to definition
does. That way you can traverse back with <C-t>
. This would be a more native way to do it imo. If there's interest I can create a pr for this.
Issues
Feature description
I think it would be good to add a hop-back keybinding to the hop module. I imagine it could be as easy as mapping a key (default as backspace imo) to
<cmd>bun<cr>
or<cmd>bp<cr>
.Help
Yes
Implementation help
I don't use multiple buffers often so I expect my suggested implementation might have ways it could break, in which case I would need suggestions on a the best way to implement.