185

I'm using macvim and I love it. I also happen to really like the default font.

My question is:

How do I change the font size in my .gvimrc? I want it to be bigger, without changing the font from the default.

All the examples I've seen specify a font then a ':' then the size.

So how do I just change the size not the font itself?

Thanks!

Alex
  • 58,815
  • 45
  • 146
  • 176

7 Answers7

144

The default font is Bitstream Vera (search for 'default font' on that page). So why not just specify that, but with a different font size? E.g.

:set guifont=Bitstream\ Vera\ Sans\ Mono:h14

This approach also ensures that if in future the default changes (e.g. to the system default, Monaco), you will still have your preferred font enabled.

ire_and_curses
  • 64,177
  • 22
  • 110
  • 139
  • Ah but I figured it out and it was closest to this. Thanks for getting me on the right track. It's `De Ja Vu Vera` on my system. Huh. Thanks anyhow! – Alex May 22 '10 at 04:02
  • @Alex: That's interesting. Looks like the docs are a little out of date then. This font is an extension of the original `Bitstream` font family, ["to provide a wider range of characters while retaining the original look and feel"](http://sourceforge.net/projects/dejavu/). Thanks for coming back with this info. – ire_and_curses May 22 '10 at 04:54
  • 2
    On OS X Mavericks this answer does not work. See @Denis answer, below. :set guifont=Menlo\ Regular:h16 – Travis Bear Mar 06 '14 at 17:06
114

A quick way to set the font if you don't mind a menu popping up is to type :set gfn=*.

This will allow you to adjust any property of the font without changing anything else about it.

Then you can use :set gfn to see what it is now set to and add that to your .vimrc.

As an example, in my case it shows guifont=Monaco:h12 and so in order to get the same setting on startup, I added set gfn=Monaco:h12 to my .vimrc.

chelmertz
  • 19,026
  • 4
  • 40
  • 45
Thorsten Lorenz
  • 11,293
  • 6
  • 48
  • 58
67

None of the above answers worked for me, here is what worked out:

Add to your .gvimrc, for the janus users its ~/.gvimrc.after :

set guifont=Menlo\ Regular:h14
softarn
  • 4,627
  • 3
  • 33
  • 52
Denis
  • 1,061
  • 10
  • 13
59

-= and -- will increase and decrease the font size, respectively.

Conner
  • 27,462
  • 8
  • 47
  • 72
  • I hadd du use Ctrl+Shift+= to increase fontsize. Could be because I use a Norwegian keyboard layout – smat Jan 03 '13 at 17:10
  • 1
    @smat Well, this is talking specifically about MacVim on OSX. – Conner Jan 03 '13 at 17:12
  • 4
    also, we presume if they want to change the font site, then they would like this to be a preference across sessions. This answer will not do that. – New Alexandria Jan 09 '13 at 20:32
  • 1
    @Conner Should be Cmd+Shift+= in my above comment. Thank you for spotting the error. – smat Jan 11 '13 at 15:29
10

This works great my end.

:set guifont=Menlo\ Regular:h12

John Griffiths
  • 539
  • 7
  • 14
7

One useful note is missing from the responses - you can use set guifont=* which will bring up a font-picker for you to select from the available fonts on the system. It might be OSX and Linux only, but preferable to having to enter it manually.

Once you've selected the font, you can use set guifont again which will print out the name of the font and the size you've selected. The only caveat being that any spaces need to be backslashed in your ~/.vimrc

synthesizerpatel
  • 24,615
  • 4
  • 70
  • 85
6

Changing the size in vim console font size can increase or decrease

set guifont=Menlo\ Regular:h14

For Macvim following key shortcut work

zoom out - CMD+-
zoom in -CMD+=

For Terminal

Zoom in-CMD/ctrl++
Zoom out-CMD/ctrl+-
Normal default size - CMD/cmd+0    
J4cK
  • 28,400
  • 8
  • 39
  • 54
  • yes that's correct. As you zoom in/out, the value of `fontsize` in `set guifont=Menlo\ Regular:h` will increase/decrease accordingly. – A-Dubb Feb 23 '17 at 15:42