Set MacVim default font

How to set the default font for MacVim?

I tried to add the following line

set guifont = Monaco:h12 

into one of the following files:

 ~/.vimrc ~/.gvimrc ~/Applications/MacVim/MacVim.app/Contents/Resources/vim/vimrc ~/Applications/MacVim/MacVim.app/Contents/Resources/vim/gvimrc ~/Applications/MacVim/MacVim.app/Contents/Resources/vim/.vimrc ~/Applications/MacVim/MacVim.app/Contents/Resources/vim/.gvimrc 

I restarted MacVim, but it still won’t set the default font. What did I miss?

UPDATE: I can execute the set guifont at runtime, and it works fine. It doesn't seem to just read my boot files.

+68
vim fonts default
Dec 13 2018-11-11T00:
source share
6 answers

Put this in .gvimrc :

 set guifont=Monaco:h12 

Note the absence of spaces around the equal sign.

+108
Dec 13 '11 at 6:50
source share

If you need to install a font with spaces in the name, use a backslash in .gvimrc :

 set guifont=Fira\ Code:h12 
+66
Jan 09 '13 at 20:28
source share

The most complete answer should be the following:

 set guifont=Source\ Code\ Pro\ ExtraLight:h18 

I looked around, and every answer and tutorial that I found did not indicate how to install the font.

After manually adjusting the font using the Font window, if you don’t know exactly what to type:

 :set guifont 

This will show you the exact string value you need to put in your .vimrc file, including the font.

+15
Aug 07 '14 at 19:09
source share

Attach my font settings.

 " - font type and size setting. if has('win32') set guifont=Consolas:h12 " Win32. elseif has('gui_macvim') set guifont=Monaco:h14 " OSX. else set guifont=Monospace\ 12 " Linux. endif 
+3
Nov 27 '15 at 3:00
source share

If you're on a Mac, add these lines to your ~/.vimrc :

 set gfn=Monaco:h13 set linespace=2 
+3
Jan 10 '16 at 23:42 on
source share

To deal with not only English characters, you can put this in your .vimrc file ( guifontwide deals with Chinese characters):

 if has("gui_running") set guifont=Consolas:h14 set guifontwide=Hiragino\ Sans\ GB set linespace=2 endif 
+1
Apr 01 '17 at 11:45 on
source share



All Articles