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

Support for vim-style insert transactions #962

@bhuga

Description

@bhuga

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'?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions