Vim Recipes ‣ GUI (GVim) ‣ Changing the Font
You want to display the text in a different font.
For example, the current font isn't particularly readable, or is too large.
Standard Vim uses the font from the terminal it is run under. Gvim, however, gives you full control over the font face and size.
The command :set guifont font-name changes the current font to font-name. The font name can be followed by a size. There are, unfortunately, some platform-specific differences at this point…
Specifying guifont in an Operating-System-Specific Manner
Linux
- The font name and size are space separated.
- Spaces and commas need to be backslash escaped.
For example: :set guifont=Andale\ Mono\ 11.
Mac
- The font name and size are colon separated.
- The size is prefixed with a h.
- Spaces and commas need to be backslash escaped.
For example: :set guifont=Monaco:h11.
Windows
- The font name and size are colon separated.
- The size is prefixed with a h.
- Spaces in font names can be replaced with underscores (_).
For example: :set guifont=Andale_Mono:h11.
To change the font you need to know its name. On most operating systems you can request a GUI font chooser with the command :set guifont=*. Linux users can also use the xlsfonts utility to see a list of available fonts.
If the font you've specified can not be found, Vim complains. To avoid this you can specify multiple fonts in order of preference with a comma separated list. The first valid font is loaded. For example: :set guifont=Screen15,\ 7x13. This approach is particularly useful if you use your Vim configuration on multiple computers, or if you simply want it to be portable.