-
As the title says, I'm wondering how I can resize the font dynamically in neovide. I can use |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments 4 replies
-
(Sorry, I accidently submitted the issue way to early here, I'll fix that quickly and reopen it) |
Beta Was this translation helpful? Give feedback.
-
There's no built-in for changing the size up or down. The simplest option would be to set guifont but that can be less than ideal if you're changing the font frequently. With some vimscript you should be able to create a key binding for it. |
Beta Was this translation helpful? Give feedback.
-
In #856 the OP had this snippet for the resize function itself: let s:guifontsize = 10
let s:guifont = "JetBrainsMono\\ Nerd\\ Font"
function! AdjustFontSize(amount)
let s:guifontsize = s:guifontsize+a:amount
exe "set guifont=" .. s:guifont .. ":h" .. s:guifontsize
endfunction Is that enough for your purposes? You could map that function to |
Beta Was this translation helpful? Give feedback.
-
Hm... apparently my font setting doesn't get loaded if I have this line: set guifont="Fira\\ Code\\ SemiBold:h13" it only works if I have it like this: set guifont=Fira\ Code\ SemiBold:h13 |
Beta Was this translation helpful? Give feedback.
-
Fair enough, I referred to the function. My fault for pasting the whole snippet instead. |
Beta Was this translation helpful? Give feedback.
-
Oh, well since I can't use a string it doesn't look like that I can use this function. |
Beta Was this translation helpful? Give feedback.
-
You can use a string. The |
Beta Was this translation helpful? Give feedback.
-
(offloaded the discussion to Discord, closing) |
Beta Was this translation helpful? Give feedback.
-
Alright, I have the following settings: let s:guifontsize=10
let s:guifont="Fira\\ Code\\ SemiBold"
set guifont=Fira\ Code\ SemiBold:h13
let g:neovide_refresh_rate=60
let g:neovide_transparency=0.8
let g:neovide_no_idle=v:false
let g:neovide_fullscreen=v:false
let g:neovide_cursor_animation_length=0.20
let g:neovide_cursor_trail_length=0.5
let g:neovide_cursor_antialiasing=v:true
let g:neovide_cursor_vfx_mode = "ripple"
let g:neovide_cursor_vfx_opacity=200.0
let g:neovide_cursor_vfx_particle_lifetime=1.2
let g:neovide_cursor_vfx_particle_density=7.0
let g:neovide_cursor_vfx_particle_speed=10.0
let g:neovide_cursor_vfx_particle_phase=1.5
let g:neovide_cursor_vfx_particle_curl=1.0
function! AdjustFontSize(amount)
let s:guifontsize = s:guifontsize + a:amount
execute "set guifont=" .. s:guifont .. ":h" .. s:guifontsize
endfunction
nnoremap <C-+> <cmd>call AdjustFontSize(+1)<cr>
nnoremap <C--> <cmd>call AdjustFontSize(-1)<cr> thanks! |
Beta Was this translation helpful? Give feedback.
-
Not sure if this was a thing at the time of this issue, but this is how I'm doing it now: local map = vim.keymap.set
local function neovideScale(amount)
local temp = vim.g.neovide_scale_factor + amount
if temp < 0.5 then
return
end
vim.g.neovide_scale_factor = temp
end
map("n", "<C-=>", function()
neovideScale(0.1)
end)
map("n", "<C-->", function()
neovideScale(-0.1)
end) |
Beta Was this translation helpful? Give feedback.
-
This works flawlessly and is the simplest solution, hope it helps! if vim.g.neovide then
vim.keymap.set({ "n", "v" }, "<C-+>", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + 0.1<CR>")
vim.keymap.set({ "n", "v" }, "<C-->", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor - 0.1<CR>")
vim.keymap.set({ "n", "v" }, "<C-0>", ":lua vim.g.neovide_scale_factor = 1<CR>")
end |
Beta Was this translation helpful? Give feedback.
-
What file is that in? |
Beta Was this translation helpful? Give feedback.
-
Thanks for this! Just in case it saves someone else 7 seconds on google; I modified warlords example to change the scaling with the scrollwheel just like Nvy or VSCode.
|
Beta Was this translation helpful? Give feedback.
This works flawlessly and is the simplest solution, hope it helps!
( *updates the screen immediately, divide by 0 is handled by neovide and just closes the app )