mirror of https://github.com/sgoudham/neovide.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.2 KiB
2.2 KiB
Frequently Asked Questions
Commonly asked questions, or just explanations/elaborations on stuff.
How Can I Set The Font/Scale The UI Size?
This is handled through the guifont
option, settable through Neovim. It's technically documented
in :h guifont
(type this in Neovim), though some things are misleading there, so here we do what's
discouraged and try to document it ourselves:
- The basic format is
IBM_Plex_Mono,Hack,Noto_Color_Emoji:option1:option2
. You can use arbitrarily many "font fallbacks" (Hack
andNoto_Color_Emoji
"help out" ifIBM_Plex_Mono
doesn't define a character), and arbitrarily many options. Though please note that first all fonts are defined, then all options, the options apply "globally". - Use
:set guifont=*
to open up a window showing what fonts are accessible by Neovide, hitEnter
on one to apply it temporarily. - Spaces in the font name are a bit difficult to write, either use underscores (
_
) or escape them (\
). - The font options Neovide supports at the moment are:
hXX
— Set the font size toXX
, can be any (even non-two-digit) number or even a floating point number.b
— Sets the font bold.i
— Sets the font italic.
By the way, the default font used is Fira Code at size 14.
How Can I Dynamically Change The Font Size At Runtime?
Not directly in Neovide, but configurable if you want so. A way to accomplish that in Lua would be:
vim.g.gui_font_default_size = 12
vim.g.gui_font_size = vim.g.gui_font_default_size
vim.g.gui_font_face = "Fira Code Retina"
RefreshGuiFont = function()
vim.opt.guifont = string.format("%s:h%s",vim.g.gui_font_face, vim.g.gui_font_size)
end
ResizeGuiFont = function(delta)
vim.g.gui_font_size = vim.g.gui_font_size + delta
RefreshGuiFont()
end
ResetGuiFont = function()
vim.g.gui_font_size = vim.g.gui_font_default_size
RefreshGuiFont()
end
-- Call function on startup to set default value
ResetGuiFont()
-- Keymaps
local opts = { noremap = true, silent = true }
vim.keymap.set({'n', 'i'}, "<C-+>", function() ResizeGuiFont(1) end, opts)
vim.keymap.set({'n', 'i'}, "<C-->", function() ResizeGuiFont(-1) end, opts)
Credits to 0x0013 here.