Tuesday, February 11, 2020

Re: Applying Settings in vimrc Or gvimrc Based on v:servername

On Tue, Feb 11, 2020 at 7:36 PM <johanns@nacs.net> wrote:
>
> 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.

Try placing the check in an autocommand for the VimEnter event, which
is triggered at the very end of startup. The autocommand can be
defined in your vimrc.

Best regards,
Tony.

--
--
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/CAJkCKXsx9ofmgJDsD6RRv-pGDy3H7hK53QxZa1_Rz16Yjxmfww%40mail.gmail.com.

No comments:

Post a Comment