gbprod / yanky.nvim

Improved Yank and Put functionalities for Neovim
Do What The F*ck You Want To Public License
802 stars 22 forks source link

feat: Add timer option to preserve cursor position functionality #172

Open marcoSven opened 3 months ago

marcoSven commented 3 months ago

This commit introduces an optional parameter, 'timer', to the 'preserve_cursor_position' feature. The inclusion of this parameter helps prevent a potentially jarring cursor jump after a lengthy multiline yank operation with a downwards motion.

gbprod commented 3 months ago

Thanks for this PR !

I'm currently on vacation and I can't test and review this for the moment. I'll do this when I come back 😅

marcoSven commented 3 months ago

No worries no rush - enjoy you vacation!

Here are my configs


highlight = {
on_put = true,
on_yank = true,
timer = 500,
},
preserve_cursor_position = {
enabled = true,
timer = 458,
},

A possible additional improvement, for another PR, could be to conditionally jump back immediately if only one line is yanked.

gbprod commented 2 months ago

Hey, Sorry for the late answer. Can you add a description of this option in the README here : https://github.com/gbprod/yanky.nvim/blob/main/README.md?plain=1#L507 and add the option here : https://github.com/gbprod/yanky.nvim/blob/main/README.md?plain=1#L497 Otherwise, it seems ok :)