-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Set jumplist before jumping #305
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: max397574 <81827001+max397574@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some notes about edge cases.
I will note that I did a couple of tests myself just playing around with setting the '
mark, and had trouble getting it to behave correctly. I didn't look into it too much, but it's entirely possible that setting the marks this way via the API behaves differently than when you do it via the m'
normal mode command.
|
||
if opts.jump then | ||
local old_cursor = vim.api.nvim_win_get_cursor(winid) | ||
vim.api.nvim_buf_set_mark(vim.api.nvim_get_current_buf(), [[']], unpack(old_cursor)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for the terrible naming, this API needs some refactoring. The "jump" parameter doesn't mean what you think it means. When it's true, it means that we will focus the source window as part of this navigation action. So when you're just navigating around within the same buffer using :AerialNext/Prev
, this value will be false.
Another thing to note: we're jumping to a location in winid
, but winid
is not necessarily the active window right here. You'll probably need to use nvim_win_get_buf()
for the buffer, and you might need to do a nvim_win_call
as well to make sure the mark is set in the appropriate window. If you want to test it, I would expect this to come up if your cursor is in the aerial window when you run :AerialNext/Prev
.
Just wanted to nudge this a little, would be super helpful to have jumplist integrated here 🙏
|
Closes #266. We may also want to add a configuration parameter if users should be able to disable/enable this behavior, but I think it's a reasonable enough default that it may be OK to wait for complaints before adding this.
I have not tested this extensively with weird window options/layouts, etc., but it has worked for my basic use case.