I can place the following code into my _vimrc file on Windows 7/10 and the font will default to 'Consolas - size 11' when I launch gVim.

if has("gui_running")
  if has("gui_gtk2")
    set guifont=Ubuntu Mono\ 15
  elseif has("gui_macvim")
    set guifont=Menlo\ Regular:h14
  elseif has("gui_win32")
    set guifont=Consolas:h11:cANSI

If I place this same code into my Ubuntu 18.04 vimrc file I don't get the expected 'Ubuntu Mono - size 15'. I just get the default font and size, as if my new vimrc code did nothing.

What do I need to change in my code?

1 Answer 1


I don't have a Linux machine with graphical interface here to test it, but I'd say the correct syntax for that line would be something like:

set guifont=Ubuntu\ Mono\ 15

  • 1
    @joão-a-toledo It's set guifont=Ubuntu\ Mono\ 15. Just tested on Ubuntu. Could you fix it?
    – Ralf
    Jan 4, 2019 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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