Wikia

Vim Tips Wiki

Changes: Change font

Edit

Back to page

(Comments: font works fine in .vimrc)
 
Line 54: Line 54:
 
NOTE: setting the font in your $HOME\_vimrc file in Windows will disable the search highlighting.
 
NOTE: setting the font in your $HOME\_vimrc file in Windows will disable the search highlighting.
 
:What? No, it doesn't. I use search highlighting and also set the font in my .vimrc on Windows. I'd post to vim_use for help on that problem. --[[User:Fritzophrenic|Fritzophrenic]] ([[User talk:Fritzophrenic|talk]]) 17:40, December 11, 2013 (UTC)
 
:What? No, it doesn't. I use search highlighting and also set the font in my .vimrc on Windows. I'd post to vim_use for help on that problem. --[[User:Fritzophrenic|Fritzophrenic]] ([[User talk:Fritzophrenic|talk]]) 17:40, December 11, 2013 (UTC)
  +
  +
::Just include the following code in your _vimrc file (below set guifont statement) and search highlighting will be OK :
  +
<pre>set hlsearch</pre>

Latest revision as of 14:06, July 2, 2014

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

guifont=Lucida_Console:h11

Make a note of this string. Now put a line in your vimrc to set guifont to this value, like this:

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

Note: If there is a space in the text printed, such as

guifont=Monospace 10

it will be necessary to escape the space

set guifont=Monospace\ 10

See alsoEdit

CommentsEdit

Am keeping this as a simple form of VimTip632 for newcomers.


How about for console vimmers? :-(

Console Vim uses whatever font your 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. I believe Vim cannot use a different font than the rest of the terminal. --Fritzophrenic 15:25, July 25, 2011 (UTC)
Indeed. When running inside a terminal, Vim can, at most, change the colours (within the limits of the colours supported by the terminal: sometimes bold and unbold black and white, often 8 colours plus bold/unbold foreground only [or seen another way, 8 background and 16 foreground]; on X11 some terminals support up to 256 background and foreground colours; "changing colours" usually also includes the use of reverse-video), and, if the terminal supports them (not all terminals do, and even those which do may support it only with certain fonts), use bold, underline and/or italic. — Tonymec 05:44, July 26, 2011 (UTC)

NOTE: setting the font in your $HOME\_vimrc file in Windows will disable the search highlighting.

What? No, it doesn't. I use search highlighting and also set the font in my .vimrc on Windows. I'd post to vim_use for help on that problem. --Fritzophrenic (talk) 17:40, December 11, 2013 (UTC)
Just include the following code in your _vimrc file (below set guifont statement) and search highlighting will be OK :
set hlsearch

Around Wikia's network

Random Wiki