一般来说,我们在SHELL里启动编辑器都是直接输入命令的,如
$ vim
$ emacs
等等。
但在SHELL里也有一个快捷键 C-x C-e可以直接启动编辑器。
说明如下:
`edit-and-execute-command (C-xC-e)'
Invoke an editor on the current command line, and execute the
result as shell commands. Bash attempts to invoke `$VISUAL',
`$EDITOR', and `emacs' as the editor, in that order.
这里Ctrl-X按下之后需要再按Ctrl-E,这样会打开默认的编辑器。
如上所述,它会按一个顺序去判断默认的编辑器,先判断$VISUAL环境变量,
然后是$EDITOR环境变量,如果都没有设那就直接调用emacs。
如果你的编辑器是vim的话,那么就需要在$HOME/.bashrc里追加如下设置:
export EDITOR="vimx"