echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.84k stars 183 forks source link

mini.bracketed go forward/backward in dot repeats #667

Closed gerazov closed 7 months ago

gerazov commented 7 months ago

Contributing guidelines

Module(s)

mini.bracketed

Description

The dot repeat functionality is one of the best mechanics in Vim. Its limitation is that it only repeats the last action and cannot be used to repeat actions before the last. This is a problem that I occasionally run into when doing dot repeats on multiple lines.

For example if you want to dot repeat a change over an argument in a function in multiple lines and at one of these lines you do an additional edit (delete an extra white space). This new edit will now replace the previous dot repeat so you have to redo the previous action to repeat it further.

If it can be done :crossed_fingers: I imagine it working similar to "Yank selection replacing latest put region" i.e. [y and ]y, i.e. when going forward/backward it will substitute the made changes with the new ones along the way, leaving the last action for the next dot repeat.

echasnovski commented 7 months ago

Thanks for the suggestion and continuous interest in 'mini.nvim'!

Unfortunately, Neovim doesn't provide any exported functionality to track/get/set dot-repeat action. I know that because there was a need for this in 'mini.operators', but the best way was to use some hack.

In general, dot-repeat in both Neovim and Vim is implemented in the part of C code base which was not touched pretty much since before Neovim was born. So I imagine it would require much effort to export any functionality related to this.

Closing with "I'd really love to support this, but it needs upstream changes which are quite unlikely to happen".

gerazov commented 7 months ago

Ok good to know - djakuju for the input :wink: