Re: has('unix')

2006-10-26 Thread Martin Krischik
Am Mittwoch, 25. Oktober 2006 18:12 schrieb Tim Chase:
  for my font plug in I need to know which OS I am running on to
  choose an appropriate font.  Now when Sun Solaris where added
  to the list of OS I use I run into a little problem:  there is
  only has('unix') - but that's not good enough as Linux
  allows for anti alias fonts and Sun Solaris does not.

 Perhaps something like

   if has('unix')
   let os = system('uname')
   if os ~= 'Linux'
do linuxy stuff here
   elseif os ~= 'Solaris'
do solarisy stuff here
   endif
   endif

 would do the trick?

sure it would - but it also means calling an external program at startup. 
Well, if all else fails...

Martin
-- 
Martin Krischik
mailto://[EMAIL PROTECTED]


pgpFwzuQmRqMS.pgp
Description: PGP signature


Re: has('unix')

2006-10-26 Thread Tim Chase

for my font plug in I need to know which OS I am running on to
choose an appropriate font.  Now when Sun Solaris where added

[cut]


sure it would - but it also means calling an external program at startup. 
Well, if all else fails...


Well, additionally, the 'guifont' option can take a 
comma-separated list of font-names.  Thus, you could have it try 
something like


if has('unix')
set guifont=AntialiasedFontILike,FallbackFont



Tony has a common bit of useful script that he drops on the list 
occasionally when this topic comes up (which you can find at


http://article.gmane.org/gmane.editors.vim/40125

) which does some platform-sniffing to set the font accordingly. 
 A combination of these ideas should hopefully get you closer to 
having the font of your dreams. :)


-tim





Re: has('unix')

2006-10-26 Thread Gary Johnson
On 2006-10-25, Martin Krischik [EMAIL PROTECTED] wrote:
 Am Mittwoch, 25. Oktober 2006 18:12 schrieb Tim Chase:
   for my font plug in I need to know which OS I am running on to
   choose an appropriate font.  Now when Sun Solaris where added
   to the list of OS I use I run into a little problem:  there is
   only has('unix') - but that's not good enough as Linux
   allows for anti alias fonts and Sun Solaris does not.
 
  Perhaps something like
 
  if has('unix')
  let os = system('uname')
  if os ~= 'Linux'
   do linuxy stuff here
  elseif os ~= 'Solaris'
   do solarisy stuff here
  endif
  endif
 
  would do the trick?
 
 sure it would - but it also means calling an external program at startup. 
 Well, if all else fails...

You'll never notice it.  But if you're still concerned about it, you 
could execute something like

env | sort  env.linux

on your Linux system and

env | sort  env.solaris

on your solaris system, then

vimdiff env.linux env.solaris

and look for some environment variable whose presence/absence or 
value indicates which system you're on and test for that in your 
.vimrc.

HTH,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
 | Spokane, Washington, USA


Re: has('unix')

2006-10-26 Thread A.J.Mechelynck

Tim Chase wrote:

for my font plug in I need to know which OS I am running on to
choose an appropriate font.  Now when Sun Solaris where added

[cut]


sure it would - but it also means calling an external program at 
startup. Well, if all else fails...


Well, additionally, the 'guifont' option can take a comma-separated list 
of font-names.  Thus, you could have it try something like


if has('unix')
set guifont=AntialiasedFontILike,FallbackFont



Tony has a common bit of useful script that he drops on the list 
occasionally when this topic comes up (which you can find at


http://article.gmane.org/gmane.editors.vim/40125

) which does some platform-sniffing to set the font accordingly.  A 
combination of these ideas should hopefully get you closer to having the 
font of your dreams. :)


-tim






My tip has been written up as a vim-online tip (Setting the font in the GUI) 
and, since-then, it has also made it to the Vim help at :help 
setting-guifont except that the latter will set the font incorrectly in kvim, 
and not set it at all on non-x11 systems other than W32 (e.g. Macintosh 
versions with Carbon GUI).



Best regards,
Tony.


Re: [2] has('unix')

2006-10-26 Thread A.J.Mechelynck

A.J.Mechelynck wrote:

Tim Chase wrote:

for my font plug in I need to know which OS I am running on to
choose an appropriate font.  Now when Sun Solaris where added

[cut]


sure it would - but it also means calling an external program at 
startup. Well, if all else fails...


Well, additionally, the 'guifont' option can take a comma-separated 
list of font-names.  Thus, you could have it try something like


if has('unix')
set guifont=AntialiasedFontILike,FallbackFont



Tony has a common bit of useful script that he drops on the list 
occasionally when this topic comes up (which you can find at


http://article.gmane.org/gmane.editors.vim/40125

) which does some platform-sniffing to set the font accordingly.  A 
combination of these ideas should hopefully get you closer to having 
the font of your dreams. :)


-tim






My tip has been written up as a vim-online tip (Setting the font in the 
GUI) and, since-then, it has also made it to the Vim help at :help 
setting-guifont except that the latter will set the font incorrectly in 
kvim, and not set it at all on non-x11 systems other than W32 (e.g. 
Macintosh versions with Carbon GUI).



Best regards,
Tony.



P.S. After looking at the article, I notice that I later found out that the 
kvim 'guifont' mentioned there was inappropriate. kvim is obsolete anyway, but 
some versions are still in circulation, such as the 6.2.14 that comes with 
SuSE Linux 9.3. If you need the (longish) kvim value, check the comments of 
the vim-online tip, or drop me an email.



Best regards,
Tony.


Re: has('unix')

2006-10-26 Thread Yakov Lerner

On 10/25/06, Martin Krischik [EMAIL PROTECTED] wrote:

Am Mittwoch, 25. Oktober 2006 18:12 schrieb Tim Chase:
  for my font plug in I need to know which OS I am running on to
  choose an appropriate font.  Now when Sun Solaris where added
  to the list of OS I use I run into a little problem:  there is
  only has('unix') - but that's not good enough as Linux
  allows for anti alias fonts and Sun Solaris does not.

 Perhaps something like

   if has('unix')
   let os = system('uname')
   if os ~= 'Linux'
do linuxy stuff here
   elseif os ~= 'Solaris'
do solarisy stuff here
   endif
   endif

 would do the trick?

sure it would - but it also means calling an external program at startup.
Well, if all else fails...



system('uname') measures as 2 millisec on my Linux.  If this is
still bothering you (vim startup time can be  ~0.10-0.2 sec
because of plugins), you can

1. read /proc/version file and analyze the contents

2. use vim's libcall(): make your own shared library
with a function that calls uname(), and call it via libcall()

3. use perl interface, and invoke perl's POSIX::uname()

Yakov


Re: has('unix')

2006-10-26 Thread Yegappan Lakshmanan

Hi Martin,

On 10/25/06, Martin Krischik [EMAIL PROTECTED] wrote:

Am Mittwoch, 25. Oktober 2006 18:12 schrieb Tim Chase:
  for my font plug in I need to know which OS I am running on to
  choose an appropriate font.  Now when Sun Solaris where added
  to the list of OS I use I run into a little problem:  there is
  only has('unix') - but that's not good enough as Linux
  allows for anti alias fonts and Sun Solaris does not.

 Perhaps something like

   if has('unix')
   let os = system('uname')
   if os ~= 'Linux'
do linuxy stuff here
   elseif os ~= 'Solaris'
do solarisy stuff here
   endif
   endif

 would do the trick?

sure it would - but it also means calling an external program at startup.
Well, if all else fails...



I use the OSTYPE environment variable to differentiate between
Solaris and Linux systems.

if $OSTYPE =~ 'linux'
Do something
elseif $OSTYPE =~ 'solaris'
Do something
else
Do something
endif

- Yegappan


has('unix')

2006-10-25 Thread Martin Krischik
Hello,

for my font plug in I need to know which OS I am running on to choose an 
appropriate font.  Now when Sun Solaris where added to the list of OS I use I 
run into a little problem:  there is only has('unix') - but that's not good 
enough as Linux allows for anti alias fonts and Sun Solaris does not.

Any ideas?

Martin
-- 
Martin Krischik
mailto://[EMAIL PROTECTED]


pgp2PEaek20E6.pgp
Description: PGP signature


Re: has('unix')

2006-10-25 Thread Tim Chase

for my font plug in I need to know which OS I am running on to
choose an appropriate font.  Now when Sun Solaris where added
to the list of OS I use I run into a little problem:  there is
only has('unix') - but that's not good enough as Linux
allows for anti alias fonts and Sun Solaris does not.



Perhaps something like

if has('unix')
let os = system('uname')
if os ~= 'Linux'
 do linuxy stuff here
elseif os ~= 'Solaris'
 do solarisy stuff here
endif
endif

would do the trick?

-tim






Re: has('unix')

2006-10-25 Thread Mikolaj Machowski
On śro paź 25 2006, vim@vim.org wrote:
 Hello,

 for my font plug in I need to know which OS I am running on to choose an
 appropriate font.  Now when Sun Solaris where added to the list of OS I
 use I run into a little problem:  there is only has('unix') - but
 that's not good enough as Linux allows for anti alias fonts and Sun
 Solaris does not.

 Any ideas?

if has('unix')
let os = system('uname -a')
endif

Depending on value of os proceed.

m.