Bash's vim mode, not vi

人盡茶涼 提交于 2019-12-03 02:42:42
Kent

If you set EDITOR variable, in bash you can press Ctrl-x ctrl-e to edit your current command line in your EDITOR e.g. vim

EDIT

the ctrl-x ctrl-e is for emacs mode commandline editing, which is the default one. If you have already set it to vi mode, you could do what you have said, pressing the v. If you want to open the cmd line in vim, you have to set the EDITOR variable (in your .bashrc for example)

Personally I edit command line in emacs mode, even though vim is my main (and only) editor.

merlin2011

In your .bashrc, put the following line:

export VISUAL=/usr/bin/vim

If you want vim in many other contexts too, such as in git, you should also set EDITOR:

export EDITOR=/usr/bin/vim
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!