我想在readline环境中切换到vi编辑模式。但是我不想使用'set -o vi'。我想使用键盘快捷键暂时进行切换。手册页上说我可以用来做到这一点M-C-j。但这对我不起作用。
我正在使用Ubuntu和xterm。在gnome-terminal下也不起作用。
Bash明确禁用了此功能以及其他一些Readline快捷方式。请参见initialize_readline()
bash源代码(http://www.catonmat.net/download/bashline.c)中的功能:
/* In Bash, the user can switch editing modes with "set -o [vi emacs]",
so it is not necessary to allow C-M-j for context switching. Turn
off this occasionally confusing behaviour. */
rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap);
rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap);
#if defined (VI_MODE)
rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap);
#endif
我似乎无法使用Readline配置文件(.inputrc)覆盖此行为。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句