These are in my .vimrc=
"Adds another vimrc file with other settings...
:autocmd FileType html source $HOME/.vim/html_vimrc.vim
"
"Test if var set in html_vimrc exists...
:if exists("g:prog")
: let g:ok_prog=1
:endif
In .vim/html_vimrc.vim is this line:
:let g:prog=1
This has two test cases. Using :let command to check for the existence of the named g:vars: test.vim, test.html shows that the variable is not available to test.vim. It is available to test.html; however, in the resulting let display, it is listed before, above, the g:prog var. Evidently its not available to the conditional test.
The question is this true? Does the position of the g:var displayed with :let command represent the processing order. And if yes, how can I change this order to and still keep the files separate?
PS. I tried this first my conditional test with :number option.
How best to accomplish what you're shooting for depends on what it is
that you want to do. Your message doesn't really make that clear, but if
you provide some more details about your ultimate goal, people can
probably offer suggestions.
Also, just as minor comments on your code:
You don't need leading colons on the commands in a Vim script.
The idiomatic way to source a particular script based on file type is to
save it as an ftplugin. See `:help ftplugin` and, more specifically,
`:help ftplugin-name` for details on the different ways to accomplish
this.
Thanks for that.
Do you know of any documentation about the order of execution in the VIMDOCS [1] or another source?
-----
[1]: http://vimdoc.sourceforge.net/htmldoc/usr_toc.html
You can read ":help startup".
Best,
Marcin
In addition to Marcin's recommendation, you can use the :scriptnames
command to see a list of all scripts that have been sourced in the order
in which they were executed.