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