vi (vim) to read an exrc file other than ~/.exrc
We would like to be able to start vi (or vim) up with an alternative ex initialisation file. By default this is ~/.exrc.
Unfortunately vim(1), which is also brought up for "man ex" on this system, doesn't mention .exrc.
Any workarounds to provide equivalent behaviour would also be appreciated.
I was expecting the common -u conf_file to work, but that fails here. A workaround is to load no configuration file with -u NONE and then source the one you want with -c:
ex -u NONE -c 'source your_local_exrc'
Some versions of traditional vi/ex use the EXINIT environment variable as a command string to execute on startup, and execute $HOME/.exrc if it is not set. If you're running such a version, you can set EXINIT to so /other/file/to/execute to source an alternate startup file.
In your ~/.exrc (for vi) file add following lines at start
set exrc " Dangerous set secure " Diables shell and write commands in .exrc/.vimrc
This will make sure that .exrc file from the current directory will be loaded if it exists.