无法在 Zsh 中拥有类似 Bash 的 Cxe

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/890620/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 20:53:48  来源:igfitidea点击:

Unable to have Bash-like C-x-e in Zsh

bashzsh

提问by Léo Léopold Hertz ??

I found the following command in Bash which Zsh does not have in the same buttons at the thread.

我在 Bash 中发现了以下命令,而 Zsh 在线程的相同按钮中没有。

Ctrl-x-e

It opens the current input in terminal to an editor.

它将终端中的当前输入打开到编辑器。

How can you have the same command in Zsh?

如何在 Zsh 中使用相同的命令?

回答by

I'm using it with VIM mode. Basically ESC-v (or simply v if already in command mode) opens the terminal. It is setup by:

我在 VIM 模式下使用它。基本上 ESC-v (如果已经处于命令模式,则简单地使用 v)打开终端。它是通过以下方式设置的:

autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line

Here is how to setup it in emacs mode:

以下是如何在 emacs 模式下设置它:

autoload edit-command-line
zle -N edit-command-line
bindkey '^Xe' edit-command-line

Use 'bindkey -e' to to enable emacs style or ‘bindkey -v' to enable vi style.

使用 'bindkey -e' 来启用 emacs 风格或 'bindkey -v' 来启用 vi 风格。