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

gvim7: 3 startup issues

Expand Messages
  • Zdenek Sekera
    I have compiled (on RH ES Linux 3.0) [g]vim7 with the following gui s: gvim7-athena gvim7-gnome gvim7-gnome2 gvim7-gtk gvim7-gtk2 gvim7-motif I have set in
    Message 1 of 8 , Feb 27, 2006
    • 0 Attachment
      I have compiled (on RH ES Linux 3.0) [g]vim7
      with the following gui's:

      gvim7-athena
      gvim7-gnome
      gvim7-gnome2
      gvim7-gtk
      gvim7-gtk2
      gvim7-motif

      I have set
      in .gvimrc
      A. :set guifont="some font installed"
      B. :set guifont="some font not installed"

      and same in .vimrc (instead of .gvimrc) via

      if has("gui_running")
      ...
      endif

      1. What is the correct place to set it? .vimrc or .gvimrc?
      There is no clear answer in the doc IMHO (options.txt,
      gui.txt)

      2. The options.txt:3048 says when the font doesn't exist
      one should get the error message. I didn't get an error message.
      (I checked the font indeed doesn't exist via 'xlsfont')

      3. I get very strange problem for the 'gtk2' and 'gnome2'
      versions: no matter what guifont I set, existing or not
      existing, even none, the vim window will add a blank after
      every character. That is (insert mode) typing 'abc' will
      yield 'a b c '. The same happens when I edit existing file,
      every char will actually be a 'char & blank'.
      Anyone has seen this? What can cause it or how to get rid
      of it? Looks like some problem with some gtk2 lib, perhaps.

      Regards,

      ---Zdenek
    • A. J. Mechelynck
      ... [...] Either place is correct; no need to repeat it. If you set it in your vimrc you should (as you did) bracket it with if has( gui_running ) because
      Message 2 of 8 , Feb 27, 2006
      • 0 Attachment
        Zdenek Sekera wrote:
        > I have compiled (on RH ES Linux 3.0) [g]vim7
        > with the following gui's:
        >
        > gvim7-athena
        > gvim7-gnome
        > gvim7-gnome2
        > gvim7-gtk
        > gvim7-gtk2
        > gvim7-motif
        >
        > I have set
        > in .gvimrc
        > A. :set guifont="some font installed"
        > B. :set guifont="some font not installed"
        >
        > and same in .vimrc (instead of .gvimrc) via
        >
        > if has("gui_running")
        > ...
        > endif
        >
        > 1. What is the correct place to set it? .vimrc or .gvimrc?
        > There is no clear answer in the doc IMHO (options.txt,
        > gui.txt)
        [...]

        Either place is correct; no need to repeat it. If you set it in your
        vimrc you should (as you did) bracket it with if has("gui_running")
        because console Vim doesn't know about 'guifont'. Also, there are four
        different 'guifont' formats, and each GUI flavour accepts only one of
        them (change the font name and size in the following according to your
        tastes and to what you have available, but it shows the 4 possible
        formats). I have added an "exe" statement in the third if branch because
        otherwise my mailer might have added a spurious linebreak.

        if has("gui_running")
        if has("gui_gtk2")
        set guifont=Lucida\ Console\ 11
        elseif has("gui_kde")
        set guifont=Lucida\ Console/11
        elseif has("x11")
        exe "set guifont=-*-lucidatypewriter"
        \ . "-medium-r-normal-*-*-200-*-*-m-*-*"
        else
        set guifont=Lucida_Console:h11:cDEFAULT
        endif
        endif


        I don't know the answer to your other two questions.


        Best regards,
        Tony.
      • Benji Fisher
        ... [snip] ... That sounds familiar. I think I once saw something like this, and decided that gvim did not recognize the font as being monospaced. Possibly it
        Message 3 of 8 , Feb 27, 2006
        • 0 Attachment
          On Mon, Feb 27, 2006 at 04:03:15PM +0100, Zdenek Sekera wrote:
          > I have compiled (on RH ES Linux 3.0) [g]vim7
          > with the following gui's:
          [snip]
          > 3. I get very strange problem for the 'gtk2' and 'gnome2'
          > versions: no matter what guifont I set, existing or not
          > existing, even none, the vim window will add a blank after
          > every character. That is (insert mode) typing 'abc' will
          > yield 'a b c '. The same happens when I edit existing file,
          > every char will actually be a 'char & blank'.
          > Anyone has seen this? What can cause it or how to get rid
          > of it? Looks like some problem with some gtk2 lib, perhaps.

          That sounds familiar. I think I once saw something like this, and
          decided that gvim did not recognize the font as being monospaced.
          Possibly it had something to do with the 'encoding' (or related) option.
          I am using [g]vim7 on FC2 and get gtk2 by default. I have no problem
          with gfn=Courier\ 10 . What fonts have you tried?

          HTH --Benji Fisher
        • Zdenek SEKERA
          ... Thanks for this nice hint. One question, though: if it doesn t matter where this definition of guifont is, why did you choose to put it in .vimrc (I judge
          Message 4 of 8 , Feb 28, 2006
          • 0 Attachment
            A. J. Mechelynck wrote:
            > Zdenek Sekera wrote:
            >
            >>I have compiled (on RH ES Linux 3.0) [g]vim7
            >>with the following gui's:
            >>
            >>gvim7-athena
            >>gvim7-gnome
            >>gvim7-gnome2
            >>gvim7-gtk
            >>gvim7-gtk2
            >>gvim7-motif
            >>
            >>I have set
            >>in .gvimrc
            >> A. :set guifont="some font installed"
            >> B. :set guifont="some font not installed"
            >>
            >>and same in .vimrc (instead of .gvimrc) via
            >>
            >> if has("gui_running")
            >> ...
            >> endif
            >>
            >>1. What is the correct place to set it? .vimrc or .gvimrc?
            >> There is no clear answer in the doc IMHO (options.txt,
            >> gui.txt)
            >
            > [...]
            >
            > Either place is correct; no need to repeat it. If you set it in your
            > vimrc you should (as you did) bracket it with if has("gui_running")
            > because console Vim doesn't know about 'guifont'. Also, there are four
            > different 'guifont' formats, and each GUI flavour accepts only one of
            > them (change the font name and size in the following according to your
            > tastes and to what you have available, but it shows the 4 possible
            > formats). I have added an "exe" statement in the third if branch because
            > otherwise my mailer might have added a spurious linebreak.
            >
            > if has("gui_running")
            > if has("gui_gtk2")
            > set guifont=Lucida\ Console\ 11
            > elseif has("gui_kde")
            > set guifont=Lucida\ Console/11
            > elseif has("x11")
            > exe "set guifont=-*-lucidatypewriter"
            > \ . "-medium-r-normal-*-*-200-*-*-m-*-*"
            > else
            > set guifont=Lucida_Console:h11:cDEFAULT
            > endif
            > endif

            Thanks for this nice hint.
            One question, though: if it doesn't matter where this definition
            of guifont is, why did you choose to put it in .vimrc (I judge
            from using has("gui_running"), I suppose this test would not
            be neccessary if the snippet is placed in .gvimrc, correct?)
            when it is only needed when running gui? I'd feel it makes
            .vimrc unneccessary long(er) for no good reason.
            Or is there a reason I don't see?

            ---Zdenek
          • Zdenek SEKERA
            ... It surely looks like it thinks my tried fonts are not monospaced. To answer better your questions (I tested gvim-gtk2): - set guifont= no double
            Message 5 of 8 , Feb 28, 2006
            • 0 Attachment
              Benji Fisher wrote:
              > On Mon, Feb 27, 2006 at 04:03:15PM +0100, Zdenek Sekera wrote:
              >
              >>I have compiled (on RH ES Linux 3.0) [g]vim7
              >>with the following gui's:
              >
              > [snip]
              >
              >>3. I get very strange problem for the 'gtk2' and 'gnome2'
              >> versions: no matter what guifont I set, existing or not
              >> existing, even none, the vim window will add a blank after
              >> every character. That is (insert mode) typing 'abc' will
              >> yield 'a b c '. The same happens when I edit existing file,
              >> every char will actually be a 'char & blank'.
              >> Anyone has seen this? What can cause it or how to get rid
              >> of it? Looks like some problem with some gtk2 lib, perhaps.
              >
              >
              > That sounds familiar. I think I once saw something like this, and
              > decided that gvim did not recognize the font as being monospaced.
              > Possibly it had something to do with the 'encoding' (or related) option.
              > I am using [g]vim7 on FC2 and get gtk2 by default. I have no problem
              > with gfn=Courier\ 10 . What fonts have you tried?

              It surely looks like it thinks my tried fonts are not monospaced.
              To answer better your questions (I tested gvim-gtk2):

              - set guifont= no double space but I have no idea what font
              is being used

              - set guifont=screen15 (I don't have that font -> get double space)

              - set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1
              -> get double space, I have that font and use it in xterm)

              I just tried your choice 'set guifont=courier\ 10' and it works.
              Hmmmm, I don't understand it.
              'xlsfonts' doesn't show this font so I don't have so in all logic it
              should behave like the case above with 'screen15', but in this
              case I don't get double space. What's going on here ??

              Would you or anyone know the way to findout what font is actually
              used in (g)vim???

              Thanks,

              ---Zdenek
            • Benji Fisher
              ... I think a lot of people have a vimrc file but not a gvimrc. One file is simpler than two ... until it gets long and you want to overhaul it. ;) HTH
              Message 6 of 8 , Feb 28, 2006
              • 0 Attachment
                On Tue, Feb 28, 2006 at 02:13:23PM +0100, Zdenek SEKERA wrote:
                >
                > Thanks for this nice hint.
                > One question, though: if it doesn't matter where this definition
                > of guifont is, why did you choose to put it in .vimrc (I judge
                > from using has("gui_running"), I suppose this test would not
                > be neccessary if the snippet is placed in .gvimrc, correct?)
                > when it is only needed when running gui? I'd feel it makes
                > .vimrc unneccessary long(er) for no good reason.
                > Or is there a reason I don't see?
                >
                > ---Zdenek

                I think a lot of people have a vimrc file but not a gvimrc. One
                file is simpler than two ... until it gets long and you want to overhaul
                it. ;)

                HTH --Benji Fisher
              • A. J. Mechelynck
                Zdenek SEKERA wrote: [...] ... 1. I put it in the vimrc because I don t use the gvimrc. I have a lot of settings common to gvim and console vim, which must go
                Message 7 of 8 , Feb 28, 2006
                • 0 Attachment
                  Zdenek SEKERA wrote:
                  [...]
                  > Thanks for this nice hint.
                  > One question, though: if it doesn't matter where this definition
                  > of guifont is, why did you choose to put it in .vimrc (I judge
                  > from using has("gui_running"), I suppose this test would not
                  > be neccessary if the snippet is placed in .gvimrc, correct?)
                  > when it is only needed when running gui? I'd feel it makes
                  > .vimrc unneccessary long(er) for no good reason.
                  > Or is there a reason I don't see?
                  >
                  > ---Zdenek

                  1. I put it in the vimrc because I don't use the gvimrc. I have a lot of
                  settings common to gvim and console vim, which must go in the vimrc; I
                  think I have a few settings which must be done one way for console vim
                  and another way for gvim and thus require a test for has("gui_running")
                  (with a nonempty "false" branch) in the vimrc; I have found nothing yet
                  that cannot go in the vimrc and must go in the gvimrc.

                  2. Bracketed by 'if has("gui_running")', it can be put either place. In
                  the gvimrc the test would be unnecessary but harmless since
                  has("gui_running") is always TRUE when sourcing the gvimrc.


                  Best regards,
                  Tony.
                • A. J. Mechelynck
                  Zdenek SEKERA wrote: [...] ... That setting is for gvim with X11 _other_ than GTK+2 and kvim. In gvim for GTK+2 it is not valid. Try ... xlsfonts does show it,
                  Message 8 of 8 , Feb 28, 2006
                  • 0 Attachment
                    Zdenek SEKERA wrote:
                    [...]
                    > It surely looks like it thinks my tried fonts are not monospaced.
                    > To answer better your questions (I tested gvim-gtk2):
                    >
                    > - set guifont= no double space but I have no idea what font
                    > is being used
                    >
                    > - set guifont=screen15 (I don't have that font -> get double space)
                    >
                    > - set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1
                    > -> get double space, I have that font and use it in xterm)

                    That setting is for gvim with X11 _other_ than GTK+2 and kvim. In gvim
                    for GTK+2 it is not valid. Try

                    :set guifont=Fixed\ 13

                    >
                    > I just tried your choice 'set guifont=courier\ 10' and it works.
                    > Hmmmm, I don't understand it.
                    > 'xlsfonts' doesn't show this font so I don't have so in all logic it
                    > should behave like the case above with 'screen15', but in this
                    > case I don't get double space. What's going on here ??

                    xlsfonts does show it, in xlsfonts format, probably as something
                    beginning "-misc-courier-medium-r-normal-". Instead of "misc", the first
                    part could be something else.

                    >
                    > Would you or anyone know the way to findout what font is actually
                    > used in (g)vim???
                    >
                    > Thanks,
                    >
                    > ---Zdenek
                    >
                    >
                    >

                    See ":help setting-guifont" (if you have that helptag) to see the 4
                    different formats of 'guifont'. Each version of gvim accepts only one of
                    these formats. The format for 'guifont' in gvim for GTK+2 is <base
                    name><space><height>. The base name can include spaces, as in e.g.

                    :set guifont=Andale\ Mono\ 11

                    which means "11-point Andale Mono". This format is incompatible with
                    xlsfont. Remember that spaces in the value of an option (after the equal
                    sign in the ":set" statement) must be backslash-escaped.

                    On some systems, including GTK (I'm not sure about GTK+2), doing

                    :set guifont=*

                    will bring a pop-up menu similar to what you get for setting fonts in
                    other X11 or Windows applications. Another possibility, assuming you
                    have 'nocompatible' set, is to type

                    :set guifont=<Tab>

                    which will (on all flavours of gvim including those which don't
                    recognise ":set guifont=*") bring the current value on the command-line,
                    with backslash-escapes if and where needed. Edit it to your heart's
                    delight, then accept the new value with <Enter> or abandon the changes
                    with <Esc>.


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