Set MacVim default font
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
Kit
Updated on July 08, 2022Comments
-
Kit almost 2 years
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. -
Admin almost 11 yearsDo you use this font in general for programming?
-
New Alexandria almost 11 yearsI swear by it, yes. In addition to a 'retina display' my eye strain has dropped to nearly-zero
-
Memming about 10 yearsyou mean 'backslashes'?
-
qed almost 10 yearswhat does :h mean here?
-
xji about 9 years
Source Code Pro
is wonderful! RecommendSource Code Pro Light
over its regular version, though. -
Hustlion about 7 yearsYou can also just put this in your
.vimrc
file. -
Kit about 7 yearsI'm guessing
wide
means each character is encoded by more than 8 bits, hence it's wide? Or does it actually appear wide? -
Craig S. Anderson about 5 yearsI changed to use Monaco:h12 and the torte color scheme, and it works well.
-
junhan almost 5 yearsThis is really helpful especially when you need set up powerline fonts.
-
WestCoastProjects over 4 yearsHaving added that to
~/.vimrc
there is no effect on the font actually usedinmacvim