Bash 可以是 set to operate in vim mode .但是,我的 .vimrc
不再使用了。具体来说,我的 jj 到 Esc 的映射不再有效。我必须按 Esc 退出插入模式。我如何告诉 bash 使用我的 .vimrc
文件?
最佳答案
您正在寻找 bash- 的 vi 模式(这就是:bash 的 vi 输入模式,与 vi 或 vim 完全没有关系)。
据我所知,它确实与readline/inputrc有关,因此您可以看看是否可以
- 以 bash 方式绑定(bind)键
- 来自 ~/.inputrc
链接:
- bash vi editing mode
- .inputrc to make bash command-line editing like ksh
- [Wikia:]Use vi shortcuts in terminal
最后一个链接包含用于 bash 的 .inputrc
的更高级示例:
# Edit options before rerunning previous command, eg: ls a b c -> ls -al a b c
"\e-": "\C-p\C-a\M-f "
# Cycle thru completions.
"\e/": menu-complete
# glob patterns without executing, eg: 'rm *x'
"\ee": glob-expand-word
# Vim style history search
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
# Two escapes clear command line.
"\e\e": "\C-a\C-k"
关于bash - 强制 bash 在 vi 模式下使用 .vimrc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8890138/