Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vi mode key bindings in bash.sh #12

Open
wsdjeg opened this issue Mar 15, 2018 · 1 comment
Open

Add vi mode key bindings in bash.sh #12

wsdjeg opened this issue Mar 15, 2018 · 1 comment

Comments

@wsdjeg
Copy link

wsdjeg commented Mar 15, 2018

I hope someone could add vi mode key bindings for bash section.

@skywind3000
Copy link
Owner

skywind3000 commented Mar 15, 2018

命令行下我自己是用杂了,在我开始用 vim 之前就习惯bash下面 CTRL-A, CTRL-E 之类的快捷键了。后来用了 Vim 以后,bash 键位我就没改过。

我现在在 bash 下配置了这一组快捷键:

bind '"\eh":"\C-b"'
bind '"\el":"\C-f"'
bind '"\ej":"\C-n"'
bind '"\ek":"\C-p"'
bind '"\eH":"\eb"'
bind '"\eL":"\ef"'
bind '"\eJ":"\C-a"'
bind '"\eK":"\C-e"'
bind '"\e;":"ls -l\n"'
  • alt-h:光标左移
  • alt-l:光标右移
  • alt-j: 下一条历史
  • alt-k: 上一条历史
  • alt-shift-h: 向左跳一个单词
  • alt-shift-l: 向右跳一个单词
  • alt-;:执行 ls -l 命令

zsh 下也可以设置类似的:

bindkey '\eh' backward-char
bindkey '\el' forward-char
bindkey '\ej' down-line-or-history
bindkey '\ek' up-line-or-history
bindkey '\eH' backward-word
bindkey '\eL' forward-word
bindkey '\eJ' beginning-of-line
bindkey '\eK' end-of-line

配合其他几个 emacs 键位,跳到开头,跳到结尾,删除单词,删除字母,用起来还行。

被我我用成混合模式了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants