bokwoon
bokwoon

Reputation: 23

Windows10: _gvimrc guifont settings not taking effect

I'm using windows 10. I've been trying to change my font and font size to be easier on the eyes for gvim, and all my settings (syntax, ruler, numbers) work normally from my _vimrc file. I currently have

set guifont=Consolas:h12:cANSI

set guifont=Consolas\ 12

in both my _vimrc and _gvimrc files (both in $HOME). When I load :scriptnames, it shows that ~/_vimrc is loaded first and ~/_gvimrc loaded last. I have also tried

set guifont=Consolas:h12

instead of

set guifont=Consolas:h12:cANSI

Still, everytime I open vim or gvim everything is displayed in that horrid size 7 Fixedsys font. Only when I manually go to Edit->Select Font... can I actually effect a change on the font, but the next time I open vim/gvim the changes are not saved. The funny thing is when I enter :set guifont? it tells me that

guifont=Consolas 12

but the font is definitely still at Fixedsys 7. What is going on?

Upvotes: 0

Views: 1544

Answers (2)

Danny Quah
Danny Quah

Reputation: 141

What worked for me is embedded in @nperson325681's answer but not made explicit. In W10 the correct font setting turns out to be your first instruction

set guifont=Consolas:h12:cANSI

but not

set guifont=Consolas\ 12

(although the latter works for me in Linux, and is what I've seen in Vim documentation and help files). So, as @nperson325681 implicitly suggests, take out the second set guifont in your _vimrc. What your set guifont? shows does correctly reflect what your _vimrc has instructed; it simply isn't what works in W10. What I ended up doing is:

  if has('win32') || has('win64')
    set guifont=Consolas:h10:cANSI:qDRAFT
  else
    set guifont=Consolas\ 10
  endif

Hope that helps.

Upvotes: 1

mike3996
mike3996

Reputation: 17497

If you have two set guifont lines in your rc, the last will win. Try with the first line only.

After you have selected a font using the dialog, you can copy-paste the exact and correct line to your gvimrc by typing in insert-mode <C-r>=&guifont<CR>

Upvotes: 0

Related Questions