I want to remap some of the default movement bindings in fish's vi-mode (I'm using version 3.0). Specifically I want to change the $ and ^ key mappings to be E and B respectively to match what I use in vim - but I cannot find any documentation on how to do this anywhere. Does anybody know how/if it is possible to do this?
Asked
Active
Viewed 2,263 times
2
1 Answers
3
You should always specify which version of the program(s) you are using. Because in this case the preferred solution differs slightly between fish v2.x and v3.0. But in both cases it involves the bind command. So man bind is a good place to start.
Assuming you're using fish v2.x you'll want to create a function named fish_user_key_bindings in the file ~/.config/fish/functions/fish_user_key_bindings.fish. You'll place your desired bind commands in that function. You'll find the default bindings in /usr/local/share/fish/functions/fish_vi_key_bindings.fish (the directory might be different on your system). You'll want to add lines such as these to your fish_user_key_bindings.fish script:
function fish_user_key_bindings
bind -m default \$ end-of-line
bind -m default ^ beginning-of-line
end
Kurtis Rader
- 1,497
bindcommands in afish_user_key_bindingsfunction is no longer necessary. See https://github.com/fish-shell/fish-shell/issues/5191. – Kurtis Rader Feb 08 '19 at 19:43