* A.J.Mechelynck <[EMAIL PROTECTED]> [070314 07:50]:
> How can a Vim script know if we're running without an X connection?

What about if has('gui') ?

> 
> Of course, some cases are obvious, such as
> 
>       if has('unix') && !has('x11')
> 
> meaning we're on Unix with no X11 support compiled-in.
> 
> But what about an X-enabled Vim running in console mode, either with the -X 
> command-line switch, or in a terminal 
> with no access to an X server?
> 
> For instance, I might want to map the following
> 
>       :map <S-F5> cc<C-R>+
> 
> in my vimrc, to replace the current line with the clipboard. However that 
> mapping should not be enabled if we have 
> no access to the clipboard. So I wrap it in
> 
>       if has("clipboard") && (&term != "linux")
>               :map <S-F5> cc<C-R>+
>               :imap <S-F5> <C-O>cc<C-R>+
>       endif
> 
> which takes care of two cases:
> - running with no clipboard support compiled-in
> - running in the (non-X) linux console (aka /dev/tty)
> It doesn't take care, however, of the case when an X-enabled Vim was started 
> as "vim -X" in an xterm. Is there a 
> way to check for that in vimscript?
> 
> 
> Best regards,
> Tony.
> -- 
> The government [is] extremely fond of amassing great quantities of
> statistics.  These are raised to the _nth degree, the cube roots are
> extracted, and the results are arranged into elaborate and impressive
> displays.  What must be kept ever in mind, however, is that in every
> case, the figures are first put down by a village watchman, and he puts
> down anything he damn well pleases.
>               -- Sir Josiah Stamp

Reply via email to