Reverting To Emacs alt-backspace
Table of Contents
Fish decided to override the Unix/emacs behavior for alt-backspace in favor of (I think) the Common-User-Access (CUA) behavior which deletes all arguments to a command instead of the previous emacs-like behavior of deleting word by word. There's an alternate keybinding but I keep forgetting about it and end up wiping out entire paths or strings when trying to correct errors so I'm putting the prior behavior back.
Alt-Backspace
Here's what I'm adding to the fish configuration:
bind alt-backspace backward-kill-word
This was taken from user rski's comment, which also had some other keybindings which I'm not putting in since I don't normally use them anyway, but I'll document them here in case I decide I need them later.
bind ctrl-alt-h backward-kill-word
bind ctrl-backspace backward-kill-token
bind alt-delete kill-word
bind ctrl-delete kill-token
From Fish's bind documentation:
backward-kill-word
Move the word to the left of the cursor to the killring, until the start of the current word (like vim’s db)
backward-kill-token
Move the argument to the left of the cursor to the killring
Links
- Wikipedia: IBM Common User Access: General article about where the new behavior comes from.
- GitHub: Issue 12122 - Revert alt-backspace behaviour on non-macOS systems - The place I found the way to re-bind the old behavior.
- Github: Pull Request - Default bindings for token movement commands - It sounds like they were trying to unify the behavior across platforms. A nice idea, unfortunately it bit me. Maybe I'll learn ctrl-backspace one day.