10

When using the MySQL command line interface, is there any way to get it to let you use vi command editing keys instead of emacs?

Luis Alvarado
  • 209,003
  • 167
  • 543
  • 707
SpashHit
  • 1,436
  • 1
  • 16
  • 27

1 Answers1

14

The MySQL command line interface uses readline to edit a command line.

Create a file ~/.inputrc with the following content to use vi mode:

$if mysql
set editing-mode vi
$endif

Of course, if you want to use vi mode in all applications (including e.g. bash) that use readline, you can leave out the $if & $endif ... lines...

muru
  • 193,181
  • 53
  • 473
  • 722
JanC
  • 19,222
  • 4
  • 44
  • 50