Troubleshooters.Com and T.C Linux Library Present

Permanently Changing Your Graphical Vim Font

Copyright (C) 2005 by Steve Litt
[ Linux Library | Troubleshooters.Com | Email Steve Litt | Copyright Notice ]

The Problem

When using graphical Vim, the default font is usually not what you want. Your combination of monitor, video card and resolution precludes a one-size-fits-all font. You can set the font from the graphical Vim menu, or even with a set gfn= command, but that setting vanishes the moment you exit Vim. How do you set it permanently?

The Procedure

The process of permanently changing your gvim font can be broken down like this:

Use the menu to find a suitable font

First, open graphical vim using the gvim command. Edit a file convenient for evaluating fonts:
The graphical vim screen

Now navigate the menu system to select a new font (Edit->Select Font):
Editing font on menu

You'll be brought to the font selection dialog box:
The font dialog box

Select a font with the ideal size, spacing and readability for your system and needs:
Selecting the new font

In gvim, verify the usability of the new font:
How the new font looks

Use set gfn? to find the text of that font

Use the set gfn? command to find the current font, which you set in the preceding step:
Finding the current font

Copy the font text into .gvimrc

In response to the set gfn? command you issued, vim returns the font as a string. Use Linux's copy and paste mechanism to place that string into the Linux clipboard:
Gvim reveals the font

Edit the ~/.gvimrc file. Comment out any previous set gfn= commands, and then paste your new font in. Add the word "set" in the beginning:
Copy the font into .gvimrc

Backslash the Spaces

You're almost done. However, vim cannot process a multi-word font, so spaces must be escaped with backslashes:
Escaping spaces with backslashes

Now save your new ~/.gvimrc file. From now on your graphical Vim will display the new font.

See also:  [ Linux Library | Troubleshooters.Com | Email Steve Litt | Copyright Notice ]

Copyright (C)2005 by Steve Litt. -- Legal