英文:
How to set VIM key binding in ZSH/terminal
问题
在我正常使用Vim的过程中,我有一个键绑定("jj")来进入“NORMAL”模式。我通过在~/.vimrc
中设置映射配置来实现这一点 -> :imap jk <Esc>
。然而,在Mac OS终端中,ZSH中不起作用。是否有一种方法可以启用此功能?
编辑/更新:我偶然发现了这个问题,它似乎间接地回答了我的问题,但是在问题中提到了其他内容(不是答案)。我将保持此问题开放,因为原始线程并没有直接回答这个问题。
英文:
In my normal use of Vim I have a key binding ("jj") to enter NORMAL
mode. I accomplish this by setting a mapping configuration in ~/.vimrc
-> :imap jk <Esc>
. However this binding does not take effect in ZSH on Mac OS Terminal. Is there a way to enable this?
Edit/Update: I came across this question which appears to sort of indirectly answer my question within its question to something else (not its answer). Leaving this open as that original thread does not directly answer the question
答案1
得分: 1
ZSH和Vim分别在~/.zshrc
和~/.vimrc
中进行配置。您可以通过将以下行添加到您的~/.zshrc文件中,将jj
键绑定到您的zsh终端。
# 将“jj”快捷方式添加为进入NORMAL模式
bindkey -M viins 'jj' vi-cmd-mode
英文:
ZSH and Vim are configured separately, in ~/.zshrc
and ~/.vimrc
respectively. You can add the jj
key binding to your zsh terminal by adding the following line to you ~/.zshrc file.
# Add "jj" shortcut to enter NORMAL mode
bindkey -M viins 'jj' vi-cmd-mode
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论