I want to influence how my vimrc file is executed when I run vim and thought about using a global variable like
if exists("g:UseEnv1")
....
else
....
endif
This variable will be set when vim starts, for example,
gvim -c "let g:UseEnv1=1" file-1 file-2
However, this does not work because the -c ex commands are evaluated after the vimrc file is executed.
I could use environment variables
if $UseEnv1 == 1
...
endif
But I feel this is a bit problematic if I forgot to change the value of $ UseEnv1 between two sessions. Ideally, I would like to explicitly indicate that I want Env 1 when starting vim.
Are there other options?
source
share