Now with rlwrap you get a few more benefits than just a command history. I didn’t find out about this until attending Tanel Poder’s training day at the Hotsos Symposium. That’s what I get for not reading the man page, or else I would have known about these other benefits much sooner.
Who reads man pages anyway. Reading man pages is like asking for directions when your taking a hot girl out on your first date in your cool convertible.
So, the additional benefits of rlwrap are the searchable command history and the key bindings. Rlwrap, by default, uses Emacs key bindings. So CTRL-r searches the command history backwards, ctrl-a/e goes to the beginning/end of a line, etc.
I’m more of a vi guy than an Emacs man, so I looked around for getting the vi key bindings to work in sqlplus.
To get this to work, simply edit your /etc/inputrc or ~/.inputrc, and add the lines:
set editing-mode vi
set keymap vi
Restart your shell and you have vi inside sqlplus! What could be better?
For quick installation instructions of rlwrap see: Rlwrap, the third.