setting guifont in .vimrc does not work Windows 11

47 Views Asked by At

Using GVIM version 9 on Windows 11 23H2, I use Edit > Select Font to choose Lucida Console size 12 and it works as expected. When I type :set guifont? I see

set guifont=Lucida_Console:h12:cANSI:qDRAFT

If I start gvim and use the command line instead, it also works:

:set guifont=Lucida_Console:h12:cANSI:qDRAFT

I want this for every session. I have tried several things:

  1. put the line into .gvimrc:

    set guifont=Lucida_Console:h12:cANSI:qDRAFT
    
  2. put it into .vimrc with test for gui_running:

    if has('gui_running')
        set guifont=Lucida_Console:h12
    endif
    
  3. put the line into a .vimrc that contains other configurations that do work, so I know the .vimrc is being read

  4. tried it with Consolas instead of Lucida_Console

In every case, I get only the standard tiny font.

How can I make this work? Thanks.

PS I have googled and searched stackoverflow without finding an answer.

1

There are 1 best solutions below

1
Moctar On

In windows the vimrc file for GVIM is called _vimrc and must be either in the directory C:\Users\UserName or in \ C:\Program Files (x86)\Vim.