tags:

views:

156

answers:

4

Hi all

I am using the gVim7.2 on Windows 7.I can set the gui font as Consolas 10(font size) from menu . I am trying to set this in .vimrc file like below

set guifont=Consolas\ 10

But it deosn't work. Does anyone set this before?

A: 

Does this site help?

Javed Ahamed
A: 

Try setting your font from the menu and then typing

:set guifont?

This should display to you the string that Vim has set this option to. You'll need to escape any spaces.

Greg Sexton
+3  A: 

I use the following (Uses Consolas on Windows and Inconsolata everywhere else):

if has("gui_running")
  if has("gui_gtk2")
    set guifont=Inconsolata\ 12
  elseif has("gui_win32")
    set guifont=Consolas:h11:cANSI
  endif
endif

Edit: And while you're at it, you could take a look at http://www.codinghorror.com/blog/2004/12/progamming-fonts.html

Morten Siebuhr
+1  A: 

I am trying to set this in .vimrc file like below

For GUI specific settings use the .gvimrc instead of .vimrc, which on Windows is either $HOME\_gvimrc or $VIM\_gvimrc.

Check the :help .gvimrc for details. In essence, on start-up VIM reads the .vimrc. After that, if GUI is activated, it also reads the .gvimrc. IOW, all VIM general settings should be kept in .vimrc, all GUI specific things in .gvimrc. (But if you do no use console VIM then you can simply forget about the .vimrc.)

set guifont=Consolas\ 10

The syntax is wrong. After :set guifont=* you can always check the proper syntax for the font using :set guifont?. VIM Windows syntax is :set guifont=Consolas:h10. I do not see precise specification for that, though it is mentioned in the :help win32-faq.

Dummy00001