Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keymaps should record only 1 entry to the modification history #1504

Open
k2d222 opened this issue Jan 13, 2022 · 2 comments
Open

Keymaps should record only 1 entry to the modification history #1504

k2d222 opened this issue Jan 13, 2022 · 2 comments
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements

Comments

@k2d222
Copy link
Contributor

k2d222 commented Jan 13, 2022

Custom sequence keymaps (defined in user's config.toml) will execute the commands in sequence but also record each modification to the history. Undoing will undo the individual components of the sequence keymap, not the keymap as a whole.

An example:
A-s = [ "extend_to_line_bounds", "delete_selection", "paste_after" ]
This keymap will swap a line with the one below. But it requires 2 undos for paste_after and delete_selection

Possible solution:
Add commands to start / stop recording individual modifications to history. When recording is stopped, modifications will update the last history Revision instead of adding new ones.

If this feature request is found interesting, I would happily have a go at implementing it 😃

@k2d222 k2d222 added the C-enhancement Category: Improvements label Jan 13, 2022
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Jan 13, 2022
@Omnikar
Copy link
Contributor

Omnikar commented Jan 13, 2022

Yeah, it was decided to momentarily skip this behaviour in the original implementation: #589 (comment).

I do agree though that it is annoying; I can go back and implement it, and it'll be useful for macros as well, since they have the same issue.

@kirawi kirawi added A-keymap Area: Keymap and keybindings and removed A-helix-term Area: Helix term improvements labels Jan 14, 2022
@Omnikar
Copy link
Contributor

Omnikar commented Jan 14, 2022

So, this turns out to be a bit tricky due to the fact that Documents keep their own individual histories, and command sequences are capable of switching the current document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

3 participants