-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Fallback option for navigation method #766
Comments
I think this as an option is pretty obscure. You're better off setting |
Sounds like a hacky solution to me. Specially considering you are using async functions, I may need to use timeouts to make sure no move has happened for a few milliseconds. |
I do plan to add callback arguments to all actions. To begin with we can add a callback that passes no arguments? |
That would be enough for me, let me know if I can help :-) |
I can help |
@lewis6991 local pos = vim.api.nvim_win_get_cursor(0)
gitsigns.next_hunk({
wrap = false,
async = true,
}, function()
local new_pos = vim.api.nvim_win_get_cursor(0)
if new_pos[1] == pos[1] and new_pos[2] == pos[2] then
...
end
end) I'm checking if it was successful or not by checking if the cursor position has changed, it would be nice if it could report it in the callback. |
Is your feature request related to a problem? Please describe.
I implemented a shortcut to automatically go to the next/previous file when navigating hunks and it reaches end/beginning of the file. To implement this I needed gitsigns to somehow inform me when
next_hunk
/prev_hunk
failed. I read the code to find something but I didn't find anything.Describe the solution you'd like
I patched gitsigns.nvim like this:
Describe alternatives you've considered
I tried hacky solutions like overriding
nvim_echo
, or monitoring nvim-notify, etc. But none of them were stable.Additional context
I think my diff is a minimal solution just to resolve my own issue, so I thought I share it here and ask a maintainer who knows the codebase better to kindly add a more sophisticated mechanism to resolve this issue.
The text was updated successfully, but these errors were encountered: