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

126300Re: Set gfn based on screen resolution

Expand Messages
  • Tony Mechelynck
    Oct 1, 2011
      On 01/10/11 10:15, philipx wrote:
      > Is there a way to determine the screen resolution in gVim and act upon
      > that information, for example to set a different font size?
      > I seem to find myself working in two different modes: either on my
      > laptop or on a large screen. Maybe I'm getting old, or maybe the
      > distance to the screen is different between the two (I suspect I sit
      > closer to the laptop's screen), but I use Menlo:h11 on my laptop and
      > I'd like :h12 or even :h13 when I'm connected to the monitor.
      > Thank you!

      I don't think you can ask Vim for the pixel size of your screen, but you
      can do almost as good (after gvim startup, i.e. either in the gvimrc or
      in a GUIEnter autocommand):

      1. Set some standard 'guifont'
      2. :set lines=999 columns=9999
      (gvim will now set its screen size to within one character cell of your
      monitor size, and adjust the option values accordingly)
      3. Compare &lines and/or &columns with some reference values and
      increase the 'guifont' size if larger.

      Note: There are several incompatible platform-dependent 'guifont'
      formats, and each gvim version recognizes only one of them. If someday
      you find yourself on Linux and try to set the 'guifont' you set on
      Windows, it may or may not give you an error but it will almost
      certainly not set the font you expected. See

      Here are a few examples:
      :set gfn=Courier\ New\ 11
      kvim (obsolete):
      :set gfn=Courier\ New/11/-1/5/50/0/0/0/1/0
      :set gfn=Courier\ New:s11
      other X11 (including the now obsolete GTK1):
      :set gfn=-*-courier-medium-r-normal-*-*-110-*-*-m-*-*
      :set gfn=Monaco:h11
      :set gfn=Courier_New:h11:cDEFAULT

      Best regards,
      You have the body of a 19 year old. Please return it before it gets

      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
    • Show all 3 messages in this topic