Monday, March 14, 2022

Avoid jumping cursor after undo

I have defined this function:

fun! Lint()
let l:view = winsaveview()
keepjumps normal gggqG
call winrestview(l:view)
endf

When the function is executed, the cursor does not move, as expected.
Unfortunately, pressing u after that makes the cursor jump to the top of
the buffer. I had hoped that keepjumps would prevent that, but that does
not seem the case. How can I avoid moving the cursor upon undoing
(without touching registers)?

Thanks,
Life.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/t0o0f3%24i9e%241%40ciao.gmane.io.

No comments: