Binarian
Binarian

Reputation: 12446

How to get Bash's revert-line in zsh

Since macOS changed to zsh as default, I try to update my keybindings for it.

In bash I could use the following command:

bind '"\C-a": revert-line' # Revert/resets the changed history line while you are on it with the the cursor

I do not find any function like that on zsh.

bindkey "^a" what-to-put-here 

Do you know how to accomplish it with zsh?

Upvotes: 2

Views: 321

Answers (1)

Simba
Simba

Reputation: 27698

revert-line is a function provided by readline. While, ZSH doesn't depend on readline. ZSH has its own editor in command line called ZLE(ZSH Line Editor).

There doesn't seem to be a reset all function in the ZLE builtins. Correct me if I'm wrong.

undo may be an alternative for you.

undo

Incrementally undo the last text modification. When called from a user-defined widget, takes an optional argument indicating a previous state of the undo history as returned by the UNDO_CHANGE_NO variable; modifications are undone until that state is reached, subject to any limit imposed by the UNDO_LIMIT_NO variable.

bindkey "^a" undo

Upvotes: 3

Related Questions