Alternate Key-Bindings

Table of Contents

Alt-Backspace

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.

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

I don't know why you'd want to set ctrl-backspace to delete one token when backspace all by itself alread does this… peculiar.

Lowercase Word

While I'm at it - the default behavior for alt-l is to do a directory listing. Besides being redundant with ls it is a little counter-intuitive if you're used to emacs with uses this keybinding to change a word to lowercase. Oddly, the default for alt-u is to change a word to uppercase like you might expect. I'm not sure why alt-l was made the way it is, but I guess I'll change it to make words lowercase.

bind alt-l "downcase-word"

downcase-word

Make the current word lowercase.

Links