October 20, 2015

gvim on Windows: how to set font to GB2312

The Windows version of VIM that I am using is the Win-32 console and OLE GVIM flavor.  Assuming you took the defaults during the installation of the program, you will find the VIM init file in the %DRIVE%\Program Files\Vim called _vimrc.  Edit this file and add a line that looks like the following:
set guifont=Lucida_Console:h10
This will use the Lucida Console font in size 10 regular.  You can use other fonts, sizes and settings. The syntax is basically:
set guifont=font-family:size:style
Here is a snippet from the VIM help guide:
 For the Win32 GUI     *E244* *E245*
 - takes these options in the font name:
  hXX - height is XX (points, can be floating-point)
  wXX - width is XX (points, can be floating-point)
  b   - bold
  i   - italic
  u   - underline
  s   - strikeout
  cXX - character set XX. valid charsets are: ANSI, ARABIC,
        BALTIC, CHINESEBIG5, DEFAULT, EASTEUROPE, GB2312, GREEK,
        HANGEUL, HEBREW, JOHAB, MAC, OEM, RUSSIAN, SHIFTJIS,
        SYMBOL, THAI, TURKISH, VIETNAMESE ANSI and BALTIC.

   Use a ':' to separate the options.
 - A '_' can be used in the place of a space, so you don't need to use
   backslashes to escape the spaces.
 - Examples:
     :set guifont=courier_new:h12:w5:b:cRUSSIAN
     :set guifont=Andale_Mono:h7.5:w4.5

No comments:

Post a Comment