Skip to content

Accumulating cut/paste like zsh in emacs mode #896

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

Open
artem-nefedov opened this issue Mar 23, 2025 · 1 comment
Open

Accumulating cut/paste like zsh in emacs mode #896

artem-nefedov opened this issue Mar 23, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@artem-nefedov
Copy link

Related problem

In zsh, if you press Ctrl+W multiple times, all cut words get accumulated into a single buffer, and all of them will be inserted together (while preserving whitespaces in-between) when Ctrl+Y is pressed. At the same time, if perform any other action, it gets reset, and new Ctrl+W presses will start accumulating a new buffer from scratch.

This works assuming keybinds in zsh:

bindkey '^w' backward-kill-word
bindkey '^y' yank

I hope to be able to reproduce the same behavior in nu REPL.

Describe the solution you'd like

Probably a new config setting that will toggle this behavior globally.

I was initially thinking about just adding new keybind "edit" actions, like AccumulateCutWordLeft, but just this alone would not solve the resetting when other key is typed, which is also important, so a config setting seems more fitting.

Describe alternatives you've considered

No response

Additional context and details

No response

@artem-nefedov artem-nefedov added the enhancement New feature or request label Mar 23, 2025
@sholderbach
Copy link
Member

I don't think we necessarily need another config option, but there would need to be additional bookkeeping in the editor implementation to accumulate into the clipboard and resetting that when moves etc. happen.

There was an attempt to implement this in reedline with #631 that we sadly couldn't get over the finish line at the time.

It may serve as inspiration how it could be done.

Having that behavior for the emacs-like mode would certainly elevate our current hackjob of a vi emulation, by accumulating the edits. (would allow recovering multiplier deletes that are completely useless at the moment) In the long term we probably want to move of this bodged together vi-emulation and have two better principled implementations for more consistent behavior on either Emacs style edits or the modal editing.

@sholderbach sholderbach transferred this issue from nushell/nushell Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants