Fish Shell: remapping VI-mode keybindings
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
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?
fish
add a comment |
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?
fish
add a comment |
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?
fish
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?
fish
fish
edited Feb 8 at 19:33
Arthur Allshire
asked Feb 8 at 16:31
Arthur AllshireArthur Allshire
11
11
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
Oh, sorry. I am using 3.0. Edited question.
– Arthur Allshire
Feb 8 at 19:33
My answer works with fish 3.0 as well although putting thebind
commands in afish_user_key_bindings
function is no longer necessary. See github.com/fish-shell/fish-shell/issues/5191.
– Kurtis Rader
Feb 8 at 19:43
@kurtis, "no longer necessary", but if I have that function will I need to change it?
– glenn jackman
Feb 8 at 20:33
No need to change your use of fish_user_key_bindings.fish. The "no longer necessary" part of my answer simply alludes to the fact that in fish 3.0 you can define custom bindings without having to use that function. But that function is still supported.
– Kurtis Rader
Feb 9 at 18:14
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403584%2ffish-shell-remapping-vi-mode-keybindings%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
Oh, sorry. I am using 3.0. Edited question.
– Arthur Allshire
Feb 8 at 19:33
My answer works with fish 3.0 as well although putting thebind
commands in afish_user_key_bindings
function is no longer necessary. See github.com/fish-shell/fish-shell/issues/5191.
– Kurtis Rader
Feb 8 at 19:43
@kurtis, "no longer necessary", but if I have that function will I need to change it?
– glenn jackman
Feb 8 at 20:33
No need to change your use of fish_user_key_bindings.fish. The "no longer necessary" part of my answer simply alludes to the fact that in fish 3.0 you can define custom bindings without having to use that function. But that function is still supported.
– Kurtis Rader
Feb 9 at 18:14
add a comment |
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
Oh, sorry. I am using 3.0. Edited question.
– Arthur Allshire
Feb 8 at 19:33
My answer works with fish 3.0 as well although putting thebind
commands in afish_user_key_bindings
function is no longer necessary. See github.com/fish-shell/fish-shell/issues/5191.
– Kurtis Rader
Feb 8 at 19:43
@kurtis, "no longer necessary", but if I have that function will I need to change it?
– glenn jackman
Feb 8 at 20:33
No need to change your use of fish_user_key_bindings.fish. The "no longer necessary" part of my answer simply alludes to the fact that in fish 3.0 you can define custom bindings without having to use that function. But that function is still supported.
– Kurtis Rader
Feb 9 at 18:14
add a comment |
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
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
edited Feb 8 at 19:43
answered Feb 8 at 19:31
Kurtis RaderKurtis Rader
73947
73947
Oh, sorry. I am using 3.0. Edited question.
– Arthur Allshire
Feb 8 at 19:33
My answer works with fish 3.0 as well although putting thebind
commands in afish_user_key_bindings
function is no longer necessary. See github.com/fish-shell/fish-shell/issues/5191.
– Kurtis Rader
Feb 8 at 19:43
@kurtis, "no longer necessary", but if I have that function will I need to change it?
– glenn jackman
Feb 8 at 20:33
No need to change your use of fish_user_key_bindings.fish. The "no longer necessary" part of my answer simply alludes to the fact that in fish 3.0 you can define custom bindings without having to use that function. But that function is still supported.
– Kurtis Rader
Feb 9 at 18:14
add a comment |
Oh, sorry. I am using 3.0. Edited question.
– Arthur Allshire
Feb 8 at 19:33
My answer works with fish 3.0 as well although putting thebind
commands in afish_user_key_bindings
function is no longer necessary. See github.com/fish-shell/fish-shell/issues/5191.
– Kurtis Rader
Feb 8 at 19:43
@kurtis, "no longer necessary", but if I have that function will I need to change it?
– glenn jackman
Feb 8 at 20:33
No need to change your use of fish_user_key_bindings.fish. The "no longer necessary" part of my answer simply alludes to the fact that in fish 3.0 you can define custom bindings without having to use that function. But that function is still supported.
– Kurtis Rader
Feb 9 at 18:14
Oh, sorry. I am using 3.0. Edited question.
– Arthur Allshire
Feb 8 at 19:33
Oh, sorry. I am using 3.0. Edited question.
– Arthur Allshire
Feb 8 at 19:33
My answer works with fish 3.0 as well although putting the
bind
commands in a fish_user_key_bindings
function is no longer necessary. See github.com/fish-shell/fish-shell/issues/5191.– Kurtis Rader
Feb 8 at 19:43
My answer works with fish 3.0 as well although putting the
bind
commands in a fish_user_key_bindings
function is no longer necessary. See github.com/fish-shell/fish-shell/issues/5191.– Kurtis Rader
Feb 8 at 19:43
@kurtis, "no longer necessary", but if I have that function will I need to change it?
– glenn jackman
Feb 8 at 20:33
@kurtis, "no longer necessary", but if I have that function will I need to change it?
– glenn jackman
Feb 8 at 20:33
No need to change your use of fish_user_key_bindings.fish. The "no longer necessary" part of my answer simply alludes to the fact that in fish 3.0 you can define custom bindings without having to use that function. But that function is still supported.
– Kurtis Rader
Feb 9 at 18:14
No need to change your use of fish_user_key_bindings.fish. The "no longer necessary" part of my answer simply alludes to the fact that in fish 3.0 you can define custom bindings without having to use that function. But that function is still supported.
– Kurtis Rader
Feb 9 at 18:14
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403584%2ffish-shell-remapping-vi-mode-keybindings%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown