Closed andrewferrier closed 2 years ago
Hey all, it seems that adding dot-repeat for inserting delimiters wasn't as hard as I had initially thought? I would like some more people to test it out first though. I also haven't done it for changing/deleting pairs, but I'll be looking into that shortly
Yep, I tested your insert-dot-repeat
branch (you forgot to mention the branch name, but I figured it out ;) - it seems to work well for repeat when inserting delimiters, thanks!
Alright I think I have a working copy of things, including with aliasing on branch implement-dot-repeat
, e.g.
local str = "This is 'a sentence `with a lot of` nested strings' in it"
Putting the cursor in the word "lot" and typing dsq..
should delete all quotes from the line. Similarly, csqb..
should replace all quotes to open/close parenthesis pairs. Please test and let me know how it is!
One bug that I've found so far is that using the visual-mode map will "break" the dot-repeat; I see the error but haven't been able to fix it (yet). Other than that this branch seems pretty stable so far
Update: I don't think I'll fix this "bug" yet (if ever), since it seems like a relatively infrequent edge case; but also because there are two places in which the dot operator gets overwritten in visual_surround
function, and it seems impossible to get that information back after the fact.
@andrewferrier I went ahead and merged the branch into main first, as there were a sizeable amount of changes + it felt more stable than main
seemed to be anyhow.
Yep, just did a bit of testing - the changes on main
seem pretty robust! From what I can tell this is completed. Thanks!
I noted from reddit you're already aware that dot-repeat is a potential gap in nvim-surround, and I agree this would be super-useful; this is one of the main advantages of a surround plugin in my mind for really speeding up editing. This article might be very helpful when implementing that: https://www.vikasraj.dev/blog/vim-dot-repeat.