Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get vi keybindings to work in mysql client?

I have vi bindings working in my bash shell using set -o vi in my .bash_profile. But I can't seem to get them to work in the mysql command line client. I only get emacs style bindings. How do you do this?

I also put these lines in my .inputrc, but to with no effect:

set editing-mode vi set keymap vi 
like image 583
dan Avatar asked Feb 07 '10 08:02

dan


People also ask

How do I run MySQL client from command line?

Launch the MySQL Command-Line Client. To launch the client, enter the following command in a Command Prompt window: mysql -u root -p . The -p option is needed only if a root password is defined for MySQL. Enter the password when prompted.

What is tee command in MySQL?

Tee is a unix command that takes the standard out output of a Unix command and writes it to both your terminal and a file.


2 Answers

Quick google reveals this... don't know if it helps.

Copied here for convenience:

Add the following on OS X 10.5:

$ cat .editrc bind -v 

This will work for OS X 10.4 and other operating systems:

$ cat .inputrc set editing-mode vi 
like image 74
John Weldon Avatar answered Oct 01 '22 10:10

John Weldon


These two files worked on my previous workstation (not sure of the MySQL version (my old job)). I keep my dotFiles in git.

.editrc

bind -v bind \\t rl_complete 

.inputrc (several of these may or may-not be needed)

set editing-mode vi set keymap vi set meta-flag on set input-meta on set convert-meta off set output-meta on set bell-style none 

Posting these because I couldn't post them in my comment above.

like image 21
John Hirbour Avatar answered Oct 01 '22 10:10

John Hirbour