I'd like to use vi (set -o vi
can do the trick) as default in my shell instead of emacs, but I do not want to put it into bash startup scripts.
Why? Because I work as verification engineer and I am using several user accounts, which are also quite often reinstalled. Changing of default profile is not answer too, because some of software creates its own home directory (independent on default profile).
EDIT: I know you gave me several ways how to do it at startup or anytime, but I do want to change it somewhere in system and have it as default, is this possible?
This is actually fairly intuitive when you think about it, although it is not as obvious as it might seem at first. The following command will give you what you want:
This will launch an interactive shell in vi mode. Lets break it down.
ssh -t somehost
connects to the host (obviously) and opens up a tty session."bash -i -o vi"
does two things. First, it launches bash in interactive mode, i.e., the shell you typically would receive when you login. This reads in the bash profiles, etc., and brings you to a prompt. The second argument,-o vi
, enables shell options, specifically, vi mode.To use this in a realistic environment, you'll probably want to do something like the following (adapting the path to bash or your shell of choice):
And called as...
Hope this helps!
Maybe, I just did not understand the problem, but to me it does not seem to be a problem at all: typical GNU systems do have a global
/etc/inputrc
config, doesn’t your?vi
mode forreadline(3)
can be enabled by adding:to it, of course.
It sounds like you want Putty to run a script for you. Have a look at ExtraPutty. or Kitty's auto-command.
It seems to be impossible to do it only by configuration changes.
One possible solution seems to be change and recompile "readline" library.
bash$ export EDITOR=vi all software that looks for this variable will use vi you can write as is into .bashrc so every time you start screen will use it
The answer is:
Edit .*rc shell file (.bashrc .kshrc)
Add line
set -o vi
Source shell profile file (.bash_profile / .profile) source ./.bash_profile
Check
set -o|egrep -w "(vi|emacs)"