Is it possible to set vim’s servername from my vimrc instead of using the --servername command line switch? If I try one of
set v:servername="TEX"
let v:servername="TEX"
I get unknown option error and cannot overwrite read-only variable error respectively.
2023 update
As pointed out by @user202729 in his answer (give him credit), it’s possible to do since 8.0.0475 patch (18 March 2017) by starting Vim with
--servername=(by default some unique name is generated) and then usingcall remote_startserver('TEX')invimrc.Original (outdated) answer from 2012
According to documentation (
:help v:servername) thev:servernamevariable is read only.And according to source code
serverRegisterName()inif_xcmdsrv.cis called from three places:main()functionSo the answer to your question is no, you can’t set server name in your
.vimrcor anywhere else except command line arguments.