You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that when I do a cosco action and undo it, my cursor do not comes back to where it was. Is it possible to ensure it will persist the position?
The text was updated successfully, but these errors were encountered:
So... I've been playing and researching a bit about this... I think this is actually in sync with the way vim works: if you execute a :s command (which is what cosco does under the hood) and then undo that :s, vim will automatically place the cursor in the beginning of the line.
It kind of makes sense when you think that you're executing an action in the whole line and then reverting the whole line modification.
To my basic VimL understanding, the only way to "cheat" this would be manipulate the undo tree, which I don't even think it's possible or make invisible steps, for example: going to insert mode, insert a char, delete it right after, and then executing the Cosco action (hence undo would go to the previous insertion point (which was were your cursor was).
But I'm not very keen on this solution as it may have undesired side effects as changing the user's jump list or maybe even make the command slower/noticeable in slower environments. And this a bad practice for plugins (to change vim's default behaviour). What do you think?
What I would suggest until we find a solution for this case is: after undoing (and vim placing your cursor in the beginning of the line), hit Ctrl-o to jump back to where you were.
I'd be happy to hear from more experienced vim scripters :)
Opening first Cosco issue on the Halloween 👻
I noticed that when I do a cosco action and undo it, my cursor do not comes back to where it was. Is it possible to ensure it will persist the position?
The text was updated successfully, but these errors were encountered: