I was discussing about how some applications have adopted some of the vi key bindings. Like Google Reader, some tiling window managers like xmonad, and even bash has excellent support for editing in vi mode. Surprisingly not many know about this. Hence this post.
Bash supports two editing modes, vi and emacs (which is the default) equally well. So you have to do something more to use the vi editing mode, and that something more is put the following in your
set -o vi
However, unlike vi, it is by default in the insert mode. However, do not get discouraged, you can use the
Esc key to go in the command mode and use the vi key bindings for moving around. It is god-sent when I work with long commands. Additionally, the commands
k will let you move through the command history. And, here comes the best part, you can use the command
v to launch the editor and edit the command in there. I have this habit of concatenating commands in one single line, and before I know it gets unmanageable on the command line. Nothing like being able to seamlessly edit with my favourite editor.
There is a nice cheat sheet available if you are interested in using this. If you are a vi or vim user, this can ease your life a lot.