Is there a way to read a .vimrc
file for only a single ssh session? That is, when I log in I perform some operation so that vim uses say /tmp/myvimrc
until I log out?
I do not want to permanently overwrite the current .vimrc, I just need to use a different set of settings for the duration of my login every once in a while.
Best Answer
Suppose you have this other set of settings in
/tmp/myvimrc
. If my reading ofman vim
is correct you can start vim with this set of settings using the following:Thus, to make this an option for the rest of the session, I would create a function that sets this as an alias for
vim
. Thus, inbash
I would put something like this in my.bashrc
file:Then, when I wanted my new vim settings, I would just run:
Note that I wouldn't store myvimrc in
/tmp
since this could easily be cleared out upon reboot. If you are using a shell other thanbash
this should still be possible, but the syntax could differ slightly.