Set MacVim default font
How do I set the default font for MacVim?
I have tried adding the following line
set guifont = Monaco:h12
to either 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. Anything I missed?
UPDATE: I can issue the set guifont
command in runtime and it works fine. It just doesn't seem to read it off my startup files.
Solution 1:
Place this in .gvimrc
:
set guifont=Monaco:h12
Note the lack of spaces around the equals sign.
Solution 2:
If you need to set a font with spaces in the name, use backslashes in your .gvimrc
:
set guifont=Fira\ Code:h12
Solution 3:
The most complete answer should be this:
set guifont=Source\ Code\ Pro\ ExtraLight:h18
I looked around and each answer and tutorial I found didn't specify how to set the typeface.
After setting your font manually using the Font window, if you are unsure exactly what to put type:
:set guifont
This will show you the exact string value you need to put in your .vimrc file, including the typeface.
Solution 4:
Attach my fonts setting.
" - 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
Solution 5:
If you're on Mac, add these lines to your ~/.vimrc
:
set gfn=Monaco:h13
set linespace=2