If you launch your first Vim session with the argument
$ vim --servername VIM
then you can send any command from any other shell with the argument
For example, if you use your statusline to display the value of some variable
g:myvar, and you have the following lines in your vimrc:
let g:myvar = "foo"
Then you can change its value (
:let g:myvar = "bar") from another shell:
$ vim --remote-send ':let g:myvar = "bar"<cr>'
The statusline should reflect the change of the value.
As your last comment says it, if your Vim instance is not in normal mode, the previous command will not work as expected. There may be simpler, but here are 2 possible solutions:
1) add the key
<esc> to be in normal mode
2) use the argument
--remote-expr instead of
--remote-send to evaluate an expression and write a small helper function whose code will assign the new value to your variable
$ vim --remote-send '<esc>:let g:myvar = "bar"<cr>'
Define the following function in your vimrc:
let g:myvar = a:value
Then, in your shell:
$ vim --remote-expr 'Myfunc("bar")'