读书人

Bash上Vi输入模式重设Ctrl-N, Ctrl-P,

发布时间: 2012-07-15 20:11:29 作者: rapoo

Bash下Vi输入模式重设Ctrl-N, Ctrl-P, Ctrl-L等快捷键
Bash下默认使用Emacs快捷键绑定,但我对Emacs并不熟,对vim要熟悉得多,所以我将Bash的输入模式换式换成了vi。但在vi模式下,我原先所使用的许多快捷键,例如Ctrl-L, Ctrl-N, Ctrl-P, Ctrl-A, Ctrl-E都失效了。幸好,Bash使用readline,借助readline的可扩展性,我们可以将这些键重新映射到它们的原来的功能。

设置方法是先临时将输入模式切换回Emacs,使用命令:

set editing-mode viset show-all-if-ambiguous onset completion-ignore-case onset meta-flag onset convert-meta offset output-meta onset bell-style visible"\C-l": clear-screen"\C-n": next-history"\C-p": previous-history"\C-a": beginning-of-line"\C-e": end-of-line"\C-f": forward-char"\C-b": backward-char

读书人网 >操作系统

热点推荐