Search code examples
vimfontslinux-mint

Cannot set the default font of gvim in mint


i have tried to move my configuration of VIM in Mac to Linux Mint.

However, the default font of gvim cannot be set. I have already put set guifont=Monaco:h14 into my .vimrc and I have also downloaded the font into my system. I have checked out this question, the verbose command can be used to find the setting of gui_font. I used the verbose command and the result pointed to my .vimrc.

The most interesting part is that I can set the gui font by the same command: set guifont=Monaco:h14 in the running environment of gvim.


Solution

  • You are using the wrong format.

    This format:

    set guifont=Monaco:h14
    

    is for Mac OS X while you should use:

    set guifont=Monaco\ 14
    

    on Linux.

    Everything is explained very clearly in :help 'guifont'.

    Hint #1: you can do :set guifont=* to open a GUI dialog, once you have chosen your font you can simply do :set guifont to see the correct string to use in your ~/.vimrc. Don't forget to escape spaces.

    Hint #2: this other answer shows you how to make different platform-specific settings.