Discussion:
Set gVim permanent font in Windows 10
(too old to reply)
Indira
2024-04-19 23:19:43 UTC
Permalink
This didn't used to matter until my eyes went south recently.

In Windows 10 gVim, the font defaults to
Font=Fixedsys
Font style=Regular
Size=9

But there are no other size options for that specific font.
gVim:Edit > Select font > {Font,Font style,Size}

However, there are other fonts with larger sizes such as
Font=Unispace
Font style=Bold
Size=20

But the setting doesn't stick in the GUI.
How do make the font selection permanent in the Windows gVim tool?
Paul
2024-04-20 02:42:53 UTC
Permalink
Post by Indira
This didn't used to matter until my eyes went south recently.
In Windows 10 gVim, the font defaults to Font=Fixedsys
Font style=Regular
Size=9
But there are no other size options for that specific font.
gVim:Edit > Select font > {Font,Font style,Size}
However, there are other fonts with larger sizes such as
Font=Unispace
Font style=Bold
Size=20
But the setting doesn't stick in the GUI.
How do make the font selection permanent in the Windows gVim tool?
Seems like a "test" for the operator, to see if they're a Level 37 wizard or not :-)

https://www.vim.org/download.php
gvim_9.1.0_x64_signed.exe (64bit installer) <=== Unpack with 7ZIP, "Open Archive"

gvimrc_example.vim

To use it, copy it to
for Unix: ~/.gvimrc
for Amiga: s:.gvimrc
for MS-Windows: $VIM\_gvimrc <=================== I hope that isn't C:\Program Files area :-)
for Haiku: ~/config/settings/vim/gvimrc
for OpenVMS: sys$login:.gvimrc

set the X11 font to use <=== hahaha!
set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1

I wonder how they got a GUI in Windows ?

"My .vimrc (Windows, GVIM)"
https://gist.github.com/wheeyls/1114301/b1ea725788ede665902f6d4880d5078612e3adab

"set guifont=courier_new:h10 <=== commented out
set guifont=Monaco,"ProggyTinySZ",Courier\ New:h10,Courier,Lucida\ Console,Letter\ Gothic,
\Arial\ Alternative,Bitstream\ Vera\ Sans\ Mono,OCR\ A\ Extended

From this we learn (naturally actually) that there are two gvimrc files.
The system one is in $VIM, the user one is in $HOME.

https://superuser.com/questions/86246/where-should-the-vimrc-file-be-located-on-windows-7

For Vim 7.4, these are the paths it looks for on Windows

system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$HOME\vimfiles\vimrc"
3rd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
system menu file: "$VIMRUNTIME\menu.vim"

For example, one good place for gvim-specific settings would be

C:\Users\MyUsername\_gvimrc

The download "gvim_9.1.0_x64_signed.exe" smells vaguely of NSIS, and
I would not put it past them to put that in C:\Program Files. Which is
fine, as the "system vimrc" will be in there. And as the user you will
only be editing the "C:\Users\MyUsername\_gvimrc" one.

Paul
Nick Cine
2024-04-20 03:28:46 UTC
Permalink
Post by Paul
Seems like a "test" for the operator, to see if they're a Level 37 wizard or not :-)
https://www.vim.org/download.php
gvim_9.1.0_x64_signed.exe (64bit installer) <=== Unpack with 7ZIP, "Open Archive"
gvimrc_example.vim
To use it, copy it to
for Unix: ~/.gvimrc
for Amiga: s:.gvimrc
for MS-Windows: $VIM\_gvimrc <=================== I hope that isn't C:\Program Files area :-)
for Haiku: ~/config/settings/vim/gvimrc
for OpenVMS: sys$login:.gvimrc
set the X11 font to use <=== hahaha!
set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1
I wonder how they got a GUI in Windows ?
"My .vimrc (Windows, GVIM)"
https://gist.github.com/wheeyls/1114301/b1ea725788ede665902f6d4880d5078612e3adab
"set guifont=courier_new:h10 <=== commented out
set guifont=Monaco,"ProggyTinySZ",Courier\ New:h10,Courier,Lucida\ Console,Letter\ Gothic,
\Arial\ Alternative,Bitstream\ Vera\ Sans\ Mono,OCR\ A\ Extended
From this we learn (naturally actually) that there are two gvimrc files.
The system one is in $VIM, the user one is in $HOME.
https://superuser.com/questions/86246/where-should-the-vimrc-file-be-located-on-windows-7
For Vim 7.4, these are the paths it looks for on Windows
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$HOME\vimfiles\vimrc"
3rd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
system menu file: "$VIMRUNTIME\menu.vim"
For example, one good place for gvim-specific settings would be
C:\Users\MyUsername\_gvimrc
The download "gvim_9.1.0_x64_signed.exe" smells vaguely of NSIS, and
I would not put it past them to put that in C:\Program Files. Which is
fine, as the "system vimrc" will be in there. And as the user you will
only be editing the "C:\Users\MyUsername\_gvimrc" one.
In the gVim window, I typed ":set guifont=*" which brought up the font GUI.
In the Windows gVim GUI I set the font to "Lucida Console Regular 20".

Then I entered the command ":set guifont?" which reported the naming.
guifont-Lucinda_Console:h20:cANSI:qDRAFT

I ran this command to put the font name into the document ":put =&guifont"
(which put this "Lucida_Console:h20:cANSI:qDRAFT" into the current file).

Then I cut and pasted that exact result to use in the commands below.
set guifont=Lucida_Console:h20:cANSI:qDRAFT

The hardest part is finding which is your vimrc file using ":version",
which reports a ton of vimrc files that are based on other variables.
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$HOME\vimfiles\vimrc"
3rd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
defaults file: "$VIMRUNTIME\defaults.vim"
system menu file: "$VIMRUNTIME\menu.vim"

The three variables which you need to echo are:
":echo $VIM"
":echo $HOME"
":echo $VIMRUNTIME"

And then you have to just figure out if the system vimrc file
or the user vimrc file takes precedence, by a trial & error sequence.

For example:
vim $HOME\_vimrc
if has('gui_running')
set guifont=Lucida_Console:h20:cANSI:qDRAFT
endif

This information came from https://vim.fandom.com/wiki/Change_font
Loading...