commit 9492df027d0715e2bbd3508d6733fd6f6ca6de0b
parent 456fb0854235eabcde31fb5c610056ca920c51b1
Author: Rahul Yedida <yrahul3910@gmail.com>
Date: Wed, 18 Feb 2026 01:57:59 -0500
fix(defaults): 'guifont' "monospace" fallback, trim spaces #37930
Problem:
Some UI clients break if space follows the comma in 'guifont' items.
Also the new 'guifont' default may cause problems if none of the fonts are found.
Solution:
Remove trailing whitespace.
Add a "monospace" fallback which `fontconfig` can resolve on *nix systems.
Diffstat:
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
@@ -3344,7 +3344,10 @@ A jump table for the options with a short description can be found at |Q_op|.
<
*'guifont'* *'gfn'* *E235* *E596*
-'guifont' 'gfn' string (default "Source Code Pro, DejaVu Sans Mono, Courier New")
+'guifont' 'gfn' string (default (MS-Windows) "Cascadia Code,Cascadia Mono,Consolas,Courier New,monospace"
+ (Mac) "SF Mono,Menlo,Monaco,Courier New,monospace"
+ (Linux) "Source Code Pro,DejaVu Sans Mono,Courier New,monospace"
+ (others) "DejaVu Sans Mono,Courier New,monospace")
global
This is a list of fonts which will be used for the GUI version of Vim.
In its simplest form the value is just one font name. When
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
@@ -3237,7 +3237,7 @@ vim.go.gcr = vim.go.guicursor
---
---
--- @type string
-vim.o.guifont = "Source Code Pro, DejaVu Sans Mono, Courier New"
+vim.o.guifont = "Source Code Pro,DejaVu Sans Mono,Courier New,monospace"
vim.o.gfn = vim.o.guifont
vim.go.guifont = vim.o.guifont
vim.go.gfn = vim.go.guifont
diff --git a/src/nvim/option_vars.h b/src/nvim/option_vars.h
@@ -34,13 +34,13 @@
// Default values for 'guifont'
#ifdef MSWIN
-# define DFLT_GFN "Cascadia Code, Cascadia Mono, Consolas, Courier New"
+# define DFLT_GFN "Cascadia Code,Cascadia Mono,Consolas,Courier New,monospace"
#elif defined(__APPLE__)
-# define DFLT_GFN "SF Mono, Menlo, Monaco, Courier New"
+# define DFLT_GFN "SF Mono,Menlo,Monaco,Courier New,monospace"
#elif defined(__linux__)
-# define DFLT_GFN "Source Code Pro, DejaVu Sans Mono, Courier New"
+# define DFLT_GFN "Source Code Pro,DejaVu Sans Mono,Courier New,monospace"
#else
-# define DFLT_GFN "DejaVu Sans Mono, Courier New"
+# define DFLT_GFN "DejaVu Sans Mono,Courier New,monospace"
#endif
#define DFLT_GREPFORMAT "%f:%l:%m,%f:%l%m,%f %l%m"
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
@@ -3998,6 +3998,10 @@ local options = {
abbreviation = 'gfn',
defaults = {
if_true = macros('DFLT_GFN', 'string'),
+ doc = [[(MS-Windows) "Cascadia Code,Cascadia Mono,Consolas,Courier New,monospace"
+ (Mac) "SF Mono,Menlo,Monaco,Courier New,monospace"
+ (Linux) "Source Code Pro,DejaVu Sans Mono,Courier New,monospace"
+ (others) "DejaVu Sans Mono,Courier New,monospace"]],
},
desc = [=[
This is a list of fonts which will be used for the GUI version of Vim.