[CLUE-Tech] vi form of command history editor in bash?
BOF
bof at pcisys.net
Wed Dec 19 09:21:54 MST 2001
Todd A. Gibson wrote:
> Question: With RedHat, around about version 5.2 or 6.0, I found that
> bash doesn't default with vi bindings. I have to type 'set -o vi'
> to get the bindings. The rub is that I can't automate this by
> putting 'set -o vi' in .bashrc or something similar. Therefore
> everytime I open a new terminal window, I have to manually
> get the shell to recognize the vi bindings.
> 1) Does anyone else have this problem?
> 2) Is there a solution to this problem?
>
I found this somewhere I don't recall, but it seems to work.
Question: Why does command line editing fail on Red Hat when I put "set
-o vi" in my .bashrc file?
Answer: Some settings in RedHat's /etc/inputrc file conflict with vi
mode. This is what causes command line editing to fail completely when
you add "set -o vi" to your .bashrc. The inputrc file is being read
because /etc/profile sets your INPUTRC variable to /etc/inputrc. One
way to get around this problem is to put "unset INPUTRC" in your
.bash_profile file. That should allow your "set -o vi" command in
.bashrc to work. This would also allow you to create your own .inputrc
file to further refine the way your commandline works. Another way is
to put all of the keymappings in /etc/inputrc inside some if statements
that test to see whether the mode is emacs or not: $if mode=emacs
"\e0d": backward-word "\e0c": forward-word .. $endif
BOF
More information about the clue-tech
mailing list