Tuesday, February 11, 2020

Applying Settings in vimrc Or gvimrc Based on v:servername

While working on a Windows machine, I found that I could
selectively load settings or plugins based on the Vim
servername by do a regular expression check against the
v:servername variable right in vimrc.

Example:
if v:servername =~ '^\cHPWORK\d*'
ru HP/HPSpecificPlugin.vim
endif

I had been relying on this featured when sharing a vimrc
file for XWindows under Linux. What I found is that this
technique does not seem to work. I traced in the Vim
source code and it seems like v:servername is set fairly
late in start up process for Vim after the script files
have been run. Thus when vimrc is executed v:servername
is blank and all these v:servername checks are false.

Is there a place in the startup process or a sensable
technique under XWindows to trigger loading something
globally based on the v:servername value? I am using this
technique as an alternative to an auto command that
assumes a particular filename or file extension.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200211135416.GB4961%40linux.site.

No comments: