Tip 1587 Printable Monobook Previous Next

created February 16, 2008 · complexity basic · author Metacosm · version 7.0

In gvim, you can change the font using the Edit menu, Select Font. An alternative is to enter the command:

:set guifont=*

Once you have a font you like, you want to make it the default in the future. Do

:set guifont?

and Vim will display something like


Alternatively, enter the following to insert the current font setting into the buffer:

:put =&guifont

Now put a line in your vimrc to set guifont to this value, like this:

if has('gui_running')
  set guifont=Lucida_Console:h11

If there is a space in the font name, such as

guifont=Monospace 10

it is necessary to escape the space

set guifont=Monospace\ 10

The following example shows how vimrc can include settings for more than one operating system, on the assumption that the vimrc file is the same on more than one system. The example also shows how 'guioptions', a color scheme, and the window size can be set.

A picture is worth a thousand words
if has('gui_running')
  set guioptions-=T  " no toolbar
  colorscheme elflord
  set lines=60 columns=108 linespace=0
  if has('gui_win32')
    set guifont=DejaVu_Sans_Mono:h10:cANSI
    set guifont=DejaVu\ Sans\ Mono\ 10

Console VimEdit

Console Vim uses whatever font the console/terminal is using. Changing the font in your terminal is done differently depending on your system and the terminal in use. Consult the documentation or manpages for your terminal, or do a web search for how to change the font in your chosen terminal. Vim cannot use a different font than the rest of the terminal.

See alsoEdit


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.