created 2005 · complexity basic · author Bernhard Leiner · version 6.0
Here are some recommendations for fonts to use in gvim, particularly for writing programs.
- Should probably have separate tips for Linux and Windows font recommendations, or at least make it clearer what works where.
- Every font should have a screenshot and note if it is free or commercial.
Proggy Clean font from http://www.dafont.com/proggy-clean.font
Using gvim with gtk2, I had a problem installing Proggy Clean. I couldn't get the pcf font registered by freetype/fontconfig. The result was that I could select Proggy Clean via "xfontsel", but not with the gtk2 font selector. A gtk build probably would have worked.
Anyway, the ttf font works fine. Just copy ProggyCleanTT.ttf to ~/.fonts and run "fc-cache" once. This should work on every Unix system with fontconfig installed.
Then start gvim and and choose the font, or insert this in your .gvimrc:
set guifont=ProggyCleanTT\ 12
The 12pt size is necessary for a good look. On OS X, you need to set 15pt.
If you use ProggyCleanTT in gvim and the top of the font looks like garbage, with missing pieces, it is because you have the new freetype hinting turned on. Proggy is not hinted properly.
I prefer the Neep programming font created by Jim Knoble. Get the jmk-x11-fonts package from http://www.jmknoble.net/fonts/
It differentiates between a zero and the letter "O" and looks really nice. I use it for programming on a 1600x1200 screen.
- On Debian/Ubuntu:
apt-get install xfonts-jmk
- On Gentoo:
Once you have installed the font you should put a line like this in your .gvimrc file:
set guifont=Neep\ 18
You may also need to enable bitmap fonts and rebuild the font cache. On Ubuntu:
rm /etc/fonts/conf.d/70-no-bitmaps.conf fc-cache -f -v
I've been using Neep, but the characters are too small on a new laptop with a high resolution screen (1920x1200 at 15.4"). Zevv-peep is a variation on Neep for hires screens. X11 (Linux) and Windows variants are available at http://zevv.nl/play/code/zevv-neep/
- Clean, avoid clutter.
- Very clear distinction between similar characters like
0 O oand
i I l 1 |.
- Suitable for light text on a dark background.
- Not too densely packed to allow a good separation between characters.
Bitstream Vera (True Type)
Free from http://www.gnome.org/fonts/
The sans serif mono spaced version of this font is clean and legible down to 6 points on Mac OS X with a 110 dpi display.
Nearly all of my programming is via vim through an iTerm (Mac) or konsole (FreeBSD/Linux) terminal window. In the rare instances I use gvim the font has performed as expected.
Sans serif and serif fonts with variable spacing are also included.
DejaVu Sans Mono looks identical to Bitstream Vera Sans Mono, and has more international characters. See the comments section for links.
Gohu is a free (under WTFPL) pixmap font available in PCF and BDF. It is extremely legible and unambiguous in both 11 and 14 px sizes.
UW ttyp0 is a free bitmap font family with about 3000 Unicode characters, including a number of stylistic variants that can be selected at installation time (plain, dotted or slashed zeroes, straight or curly quotes, visible or invisble NBSP, etc.). Sizes range from 6x11 to 11x22 px in regular and bold; for some sizes there is also an italic version. Currently only BDF/PCF (the X11 bitmap format) is supported; if you need another format, you'll have to convert it yourself. (I won't comment on the quality; as the author I'm obviously biased :-)
Update: Starting with version 1.1, UW ttyp0 also supports Powerline.
Adobe Source Code Pro
Source Sans is a set of monospaced OpenType fonts that have been designed to work well coding environments. This family of fonts is a complementary design to the Source Sans family. Open Font License 1.1 (OFL 1.1)
- Envy Code R from http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released
- Terminus from http://www.is-vn.bg/hamster/jimmy-en.html
- ProFont from http://www.tobias-jung.de/seekingprofont/
- Triskweline from http://www.netalive.org/tinkering/triskweline/ – a superb programming font, however it has no slashed zero.
Modified version of Triskweline with slashed zero and a bold variant:
- Bitstream Vera family of fonts from http://www.bitstream.com/font_rendering/products/dev_fonts/vera.html
set guifont=Bitstream\ Vera\ Sans\ Mono\ 13.
- Deja Vu family, based off Bitstream Vera with greater range of supported characters: http://dejavu-fonts.org/wiki/index.php?title=Main_Page
- Dina from http://www.donationcoder.com/Software/Jibz/Dina/
- Droid Sans Mono is pretty nice. Bold and italic text are the same size as normal text which is nice for some colorschemes. Your Linux distro may provide this font or you can get it from google. Modified versions with dotted zero and slashed zero can be found at http://www.cosmix.org/software.
- Microsoft Consolas is an epic programming font. Obviously looks best with ClearType but can be made to look decent under Xorg. To use Consolas on gvim for Windows set:
h11is the font size 11. http://en.wikipedia.org/wiki/Consolas, http://www.microsoft.com/typography/fonts/font.aspx?FMID=1252
- 158 Using Computer Modern TT as a gvim font under Windows
- 414 Change guifont to see more of your file
- 484 Console-like fonts for Windows GVim
- 632 Setting the font in the GUI
- 774 Gtk gvim and fontconfig
- 889 Nicer looking fonts on MacOSX
I don't like any of these fonts on hires screens. They are too small on a 1600x1200 panel. Normally I use Lucida Console 12 pt.
On Windows, I use the Terminal font at 6 pts. However, it's a DOS font and that makes non English letters display all wrong. But I use it anyway because it maximizes my screen usage.
How about the common 7x14-ISO8859-1 font? The only thing I'd change is to replace the zero with a slashed one (using FontForge). http://www.ank.com.ar/fonts/
My favorite fonts are 10x20/X and fixedsys/Windows, always clear and crisp.
As has been noted, sometimes font size 16 is better for Proggy Clean.
On a Linux system, it can be useful to tell fontconfig to turn off antialiasing for specific fonts. Just create a file named
.fonts.conf in your home directory with the following content:
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <match target="font"> <test qual="any" name="family"> <string>ProggyCleanTT</string> </test> <edit name="antialias" mode="assign"> <bool>false</bool> </edit> </match> </fontconfig>
The proggy ttf didn't work well for me on FC3. Characters weren't scaled smoothly and looked jagged.
I instead prefer these Microsoft TrueType fonts: http://www.mjmwired.net/resources/mjm-fedora-fc3.html#ttf
Install the rpm and then use andale mono. They look lovely and are scaled and smoothed perfectly.
set guifont=Andale\ Mono\ 9
I've been using a monospace font (not necessarily programming-oriented though) called Inconsolata, available here.
Here are a couple link to discussion about suitable fonts: http://www.codeproject.com/KB/work/FontSurvey.aspx — with screenshots http://stackoverflow.com/questions/4689/recommended-fonts-for-programming
Envy Code R is the most awesome font in the world... I've been using it for years. http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released