Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Support for vim-style insert transactions #962

Closed
bhuga opened this issue Oct 13, 2013 · 5 comments
Closed

Support for vim-style insert transactions #962

bhuga opened this issue Oct 13, 2013 · 5 comments

Comments

@bhuga
Copy link

bhuga commented Oct 13, 2013

Vim has the interesting property that insertions are actually transactions. Batches of typing can be repeated, undone, and generally messed with atomically. For example:

2iabc<esc> will enter insert mode, let you type abc, and when you leave insert mode, abc will appear a second time, having been entered twice.

Much more usefully:

iabc<esc><move around>. will enter insert mode, type abc, leave insert mode, move to a new location, and repeat the last insert at the new location. Great for things like strings in tests.

I poked around at adding this tonight. Up in vim-mode land it's actually not that complicated, but I ran into the weeds when I started to look at the telepath library SharedString underlying text buffers. It sure looks like these classes are just aching to support this kind of thing, what with their patches and transactions, but the transactions I see in the undo history are all associated with particular locations.

Is it possible to expose the concept of patches somehow? Something like 'apply the patch in undo location n to the current cursor location'?

@mcolyer
Copy link
Contributor

mcolyer commented Oct 14, 2013

Thanks for writing this 💯. I've had the exact same thought sitting in my head but I hadn't spent the time to write it down.

The short answer is that this requires changes in Atom core's API and there are too many moving parts currently and our focus has been on our alpha 🚢. I think once that quiets down that it's definitely something we should add.

@mutle
Copy link
Contributor

mutle commented Oct 16, 2013

I would love to have this in Atom as well. This was one of the biggest issues with the old vim plugin.

I would like the following solution the best: While in insert mode you can use Command-Z as you normally do while writing. When the transaction is finished, Command-Z undoes the entire insert.

@mcolyer
Copy link
Contributor

mcolyer commented Feb 27, 2014

Another user request for this atom/vim-mode#55

@mnquintana
Copy link
Contributor

Closing in favor of atom/vim-mode#55

@lock
Copy link

lock bot commented Jan 22, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants