I merely want to change a font in Vim/GVim. That's it. This doesn't work:

font=Monaco\ 14

I've done a google search and I wonder, why is for such a elementary task there's no simple answer which works, instead I've found a lot of ambiguous, complex solutions. And none of them worked. How can I do that?

  • 3
    Which OS? What you can use depends on the OS. – muru Feb 20 '17 at 5:13

Reading the 'guifont' option is useful here. I do understand your frustrations with this option however. It seems that how you set the 'guifont' setting, is dependent on the OS.

On macOS, you set 'guifont' the following way (which is noted in :help 'guifont'):

set guifont=Monaco:h14

On other OSes (Linux, etc) you use the backslash instead to specify the font size:

set guifont=Monaco\ 14

Another useful way to set the font is to use :set guifont=* which will bring up the Font chooser for your OS. Selecting a font then will apply it for your Gvim instance.

Why this distinction between the "\" and ":" to set the font size exists, however, is a separate question which I would like to know as well.

| improve this answer | |
  • You also need to make sure the font exists; unfortunately gvim unhelpfully falls back to some ugly default font without giving an error if the font doesn't exist (like e.g. this). – Martin Tournoij Feb 20 '17 at 5:23
  • Yeah -- it seems to be it falls back on the standard Serif/UI font that you set for your WM. I don't know what's different about Macvim though that it gives you an error that the font doesn't exist. – akshay Feb 20 '17 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.