Closed MariaSolOs closed 3 weeks ago
I cooked this up real quick. Might help you.
_G.current_window_id = nil
-- keybinding to get and print the current window id
vim.keymap.set("n", "<leader>wb", function()
_G.previous_window_id = vim.api.nvim_get_current_win()
print(_G.previous_window_id)
require("flash").jump()
end, { noremap = true, silent = true })
-- Function to go to the saved window ID
local function go_to_saved_window()
if _G.previous_window_id then
vim.api.nvim_set_current_win(_G.previous_window_id)
else
print("No window ID saved")
end
end
-- Keybinding to go to the saved window ID
vim.keymap.set("n", "<leader>^", go_to_saved_window, { noremap = true, silent = true })
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
Did you check the docs?
Is your feature request related to a problem? Please describe.
When using remote flash for deleting code above the current position (e.g. say that I want to remove lines at the top of the file containing a bunch of unused imports), the cursor position shifts by the amount of lines removed.
Describe the solution you'd like
For the cursor position to be restored to the correct line, using something like marks which won't be affected by the removed code.
Describe alternatives you've considered
Live with the fact that this is me being a super nitpicker over what's already an amazing plugin :)
Additional context
No response