Loading ...
Sorry, an error occurred while loading the content.

Re: Setting up fonts for use with vim compiled with GTK-2

Expand Messages
  • A.J.Mechelynck
    ... GTK+2 uses a diffrent guifont format than all other flavours of gvim. Here s how I solve the problem in my vimrc: if has( gui_running ) if
    Message 1 of 2 , May 30, 2006
      Mun Johl wrote:
      > Hi,
      > I've installed all the pieces (I think) to get GTK-2 running on my Sun
      > Solaris 8 box. After doing so, I re-compiled vim7 and it seems to be
      > running fine except that vim doesn't know about the fonts that I use
      > most often. Specifically, the -misc-* and -adobe-* fonts.
      > I looked at the help for fonts and gtk, but I wasn't able to resolve my
      > issue. How can I get the gtk-2 version of vim to understand the fonts I
      > use with the Motif version of vim?
      > Thanks in advance.
      GTK+2 uses a diffrent 'guifont' format than all other flavours of gvim.

      Here's how I solve the problem in my vimrc:

      if has("gui_running")
      if has("gui_gtk2")
      set guifont=B&H\ LucidaTypewriter\ 15
      elseif has("gui_kde")
      set guifont=B&H\ LucidaTypewriter/15
      elseif has("x11")
      set guifont=*-lucidatypewriter-medium-r-normal-*-*-210-*-*-m-*-*
      set guifont=Lucida_Console:h15:cDEFAULT

      The relevant info can be found, but not easily, in the Vim help, and
      also (somewhat more easily) in a vimtip I wrote (currently the 2nd
      best-rated if you search for "font"). (Obviously, the first branch of
      the inner ":if" is for GTK+2, the second one for kvim, the third one for
      other X11 versions, and the last one for all the rest.) (Disregard any
      "beautifying linebreaks" added by my mail client or by yours.)

      You may also want to use

      :set guifont=*

      to select from a menu, or

      :set guifont=<Tab>

      (assuming 'nocompatible') to have gvim add the current value (with
      escaping backslashes where needed) so you can edit it /in loco/ then
      accept the new value by hitting <Enter>, or abandon the changes by
      hitting <Esc>. Don't forget to write the value you want (with its
      escaping bacslash or backslashes) into your vimrc when you're satisfied
      with how it looks.

      Best regards,
    Your message has been successfully submitted and would be delivered to recipients shortly.