-
Notifications
You must be signed in to change notification settings - Fork 225
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
Restore cursor position also with SlimeRegionSend
#354
Comments
Hi @fredrikekre You can check the issues and pull requests … similar ideas have been proposed (for example) If that's not what you meant, we can discuss alternatives. If you have an example of the behavior you would be prefer, send me
Thanks |
Thanks for the reference, I don't know why I didn't find that in my search. The suggestion in #353 (comment) is pretty close to what I had in mind, although that is annoying if you select your visual block "backwards", e.g. moving up. What I had in mind is to have the cursor "stay", meaning that I would like the cursor to end up at the same position after When selecting multiple paragraphs, perhaps even multiple screen-sizes, to send it is IMO pretty disorienting when the file scrolls back to the beginning of the region and you have to navigate back down again. This is what I expected |
Tricky… One possible workaround, use I don't think that covers all your use cases though 🤔
... if that doesn't work, send me an example — maybe I still don't understand the before-and-after |
Hi! I have a little workaround that moves cursor to the line below the visual block. You can easily modify it to make the cursor stays at the last line of your visual block. This works for backward selecting as well.
or use
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Was reminded of this issue and I just wanted to post my solution for this problem in Neovim in case someone is curious: local function slime_send_region()
local keys = ":<C-u>call slime#send_op(visualmode(), 1)<CR>"
local mode = "x"
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(keys, true, true, true), mode, true)
return
end
vim.keymap.set(
"x", "<S-CR>",
function()
local loc = vim.api.nvim_win_get_cursor(0)
slime_send_region()
vim.api.nvim_win_set_cursor(0, loc)
end
) |
When using
vim-slime
to execute script-like code I often select large portion of the code in visual mode and sending that withSlimeRegionSend
. However, when back in normal mode my cursor ends up at the beginning of the previous visual block and I have to navigate down again to wherever I stopped before sending the block. It would be very convenient if the optionslime_preserve_curpos
also applied forSlimeRegionSend
. Thanks!The text was updated successfully, but these errors were encountered: