[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: bash and set -o vi



On Tue, Jun 19, 2001 at 08:35:26PM -0400, Vincent <vguido ix netcom com> wrote:
| I use vi to edit my command line, so I execute "set -o vi" to turn on the vi
| command line editor.  It works when I set this from the command line, but
| not from .bash_profile or .bashrc.  If I put "set -o vi" in either of these
| files, I can't even unset it, I have to remove it from the file, login again
| and type "set -o vi" on the command line.
| Anyone know what's going on with this?

Depends what you expect to happen.

Login bash shells run the .bash_profile.
Other interactive bash shells run the .bashrc.
Personally, the last thing in my .bash_profile is
	. $HOME/.bashrc

Then you can just put the "set -o vi" in your .bashrc,  (here it really
belongs because it's associated with interactive shells, and it will
work for all your interactive shells.

But...

It will only take effect for new shells. Existing shells don't waste
their time monitoring the .bashrc for changes. To have them take effect
in an existing shell you must source your bashrc again:

	. $HOME/.bashrc

So in short, I think you may have been expecting instant response, whereas in
fact those files are only read by shells and particular times. So put it
in your .bashrc and make a fresh subshell:

	% bash
	%

It _should_ be active in the new shell, and can thus be expected to work
from then on for new shells.

P.S. I lied above, since I use a zsh instead of a bash (where I have the
choice). But I do the equivalent for the zsh, and what I said about the
bash config files is true.
--
Cameron Simpson, DoD#743        cs zip com au    http://www.zip.com.au/~cs/

During the Winter of '82-'83 I heard someone ask Kenny Roberts what he
thought of the Honda GP bikes.  Kenny said "Well, they're heavy, but
they're slow."	- roserunr noller com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]