Wikia

Vim Tips Wiki

Changes: The perfect programming font

Edit

Back to page

(Other: finish removing proggy)
(Note that in console Vim, things are different.)
 
(6 intermediate revisions by 6 users not shown)
Line 12: Line 12:
 
}}
 
}}
 
Here are some recommendations for fonts to use in gvim, particularly for writing programs.
 
Here are some recommendations for fonts to use in gvim, particularly for writing programs.
  +
  +
In console Vim, it is easiest to just change your whole console's font to what suits you best. Just do a search for "<Windows/Ubuntu/etc> change console font".
   
 
{{Todo}}
 
{{Todo}}
Line 31: Line 33:
 
</pre>
 
</pre>
   
The 12pt size is necessary for a good look. On OS X, you need to set 16pt.
+
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.
 
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.
Line 95: Line 97:
 
[[File:Ttyp0-mixed.png]]
 
[[File:Ttyp0-mixed.png]]
   
Website: http://www.mpi-inf.mpg.de/~uwe/misc/uw-ttyp0/
+
Website: http://people.mpi-inf.mpg.de/~uwe/misc/uw-ttyp0/
   
 
==Adobe Source Code Pro==
 
==Adobe Source Code Pro==
Line 102: Line 104:
   
 
http://sourceforge.net/projects/sourcecodepro.adobe/
 
http://sourceforge.net/projects/sourcecodepro.adobe/
  +
  +
==Creep==
  +
Creep is a free font based on the proggy tiny fonts but even smaller (4x9 pixels).
  +
Since it is created using gbdfed, currently only BDF format is available, but there
  +
are instructions on how to convert it for use in other formats.
  +
  +
[[File:Screen.png|screenshot of the creep font]]
  +
  +
Get it at: https://github.com/romeovs/creep
   
 
==Other==
 
==Other==
 
*Envy Code R from http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released
 
*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
+
*Terminus from http://terminus-font.sourceforge.net/
 
*ProFont from http://www.tobias-jung.de/seekingprofont/
 
*ProFont from http://www.tobias-jung.de/seekingprofont/
 
*Triskweline from http://www.netalive.org/tinkering/triskweline/ &ndash; a superb programming font, however it has no slashed zero.<br>Modified version of Triskweline with slashed zero and a bold variant:<br>http://wiki.blender.org/index.php/User:Ideasman42/ProgrammingFonts#triskweline
 
*Triskweline from http://www.netalive.org/tinkering/triskweline/ &ndash; a superb programming font, however it has no slashed zero.<br>Modified version of Triskweline with slashed zero and a bold variant:<br>http://wiki.blender.org/index.php/User:Ideasman42/ProgrammingFonts#triskweline
Line 122: Line 133:
 
*[[VimTip774|774 Gtk gvim and fontconfig]]
 
*[[VimTip774|774 Gtk gvim and fontconfig]]
 
*[[VimTip889|889 Nicer looking fonts on MacOSX]]
 
*[[VimTip889|889 Nicer looking fonts on MacOSX]]
  +
*[http://www.slant.co/topics/67/~what-are-the-best-programming-fonts| What are the best programming fonts? (with screenshots)]
   
 
==Comments==
 
==Comments==
Line 176: Line 188:
 
Envy Code R is the most awesome font in the world... I've been using it for years.
 
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
 
http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released
  +
----
  +
  +
Another free and gorgeous font for programming, Anonymous Pro:
  +
  +
http://www.marksimonson.com/fonts/view/anonymous-pro
 
----
 
----

Latest revision as of 16:51, December 5, 2014

Tip 914 Printable Monobook Previous Next

created 2005 · complexity basic · author Bernhard Leiner · version 6.0


Here are some recommendations for fonts to use in gvim, particularly for writing programs.

In console Vim, it is easiest to just change your whole console's font to what suits you best. Just do a search for "<Windows/Ubuntu/etc> change console font".

 TO DO 

  • 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.

ProggyEdit

Proggy Clean font from http://www.dafont.com/proggy-clean.font

Proggyclean szbp

ProggyClean (slashed zero, bold brackets)

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.

NeepEdit

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: emerge x11fonts-jmk

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

zevv-peepEdit

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/

Design considerations

  • Clean, avoid clutter.
  • Very clear distinction between similar characters like 0 O o and i I l 1 |.
  • Suitable for light text on a dark background.
  • Not too densely packed to allow a good separation between characters.

Neepfont

Bitstream Vera (True Type)Edit

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.

Bitstream Vera Sans Mono at 11 point (Mac OS X): Bitstreamverasans11

DejaVu Sans Mono looks identical to Bitstream Vera Sans Mono, and has more international characters. See the comments section for links.

GohuEdit

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.

Gohu-sample

Website: http://font.gohu.eu/

Mirror: http://demus.co/files/gohufont-2.0p0.tgz

UW ttyp0Edit

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.

Ttyp0-mixed

Website: http://people.mpi-inf.mpg.de/~uwe/misc/uw-ttyp0/

Adobe Source Code ProEdit

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)

http://sourceforge.net/projects/sourcecodepro.adobe/

CreepEdit

Creep is a free font based on the proggy tiny fonts but even smaller (4x9 pixels). Since it is created using gbdfed, currently only BDF format is available, but there are instructions on how to convert it for use in other formats.

Screen

Get it at: https://github.com/romeovs/creep

OtherEdit

See alsoEdit

CommentsEdit

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


Another free and gorgeous font for programming, Anonymous Pro:

http://www.marksimonson.com/fonts/view/anonymous-pro


Around Wikia's network

Random Wiki