Link to home
Start Free TrialLog in
Avatar of igorfactor
igorfactor

asked on

set -o vi not working in bash

I am supposed to be able to use vi command-line editing and command recollection with bash.  set -o vi does not give an error but I can't invoke the previous commands pressing Esc and then k or move the cursor in the command line with h or l.  I am using Dell Dimention XPS T-500 with Complete Mandrake 6.5 distribution.  I will appreciate your help since I got used to vi command-line editing.

Avatar of igorfactor
igorfactor

ASKER

Edited text of question.
Adjusted points to 60
so what happens when you use the j, k keys?

also do

set -o vi

then

set -o

to see if vi mode if turned on?
Try Ctrl+P for previous command.
and Ctrl+N for Next command
Then Ctrl+B for backward
and Ctrl+F for forward
set -o returns that vi is on.  Ctrl-P etc. don't work
The proposed answer doesn't work.  When I hit Esc and then,  say,  'k', I am getting a beep, next keys I hit are typed in the screen.  'set -o' returns that vi is on.
The proposed answer doesn't work.  When I hit Esc and then,  say,  'k', I am getting a beep, next keys I hit are typed in the screen.  'set -o' returns that vi is on.
Sorry iqofactor, It works on SuSE 6.2 and we don't have Mandrake, so we can't investigate for you.
ASKER CERTIFIED SOLUTION
Avatar of jyu_88
jyu_88

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I believe that the answer actually is (assuming RedHat's installation of the initial "/etc/inputrc" file):

copy /etc/inputrc to /etc/inputrc.org
vi /etc/inputrc

## remove ALL lines since they refer to Emacs controls,  and add the lines:

set editing-mode vi
set keymap vi
This is a good idea. But in multiuser environment it would, probably, be better if we put the user preferred options into ~/.inputrc and make  /etc/inputrc have the only line:

$include ~/.inputrc
All users must submit to "vi"...  (or die..).

If the few (like the DBA's) still want to use Emacs, they can configure it manually (as you suggested above)...

The 'gist' of my suggestion was to change the 'default' from Emacs to vi  (obviously not improving on the 'system-wide' issue...)