From 040b544cc6cd0995574d1828bd10a93605932fa3 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Wed, 17 Apr 2024 14:42:27 -0500 Subject: [PATCH] feat(nvim): add keys for zoom in, out, & reset in Neovide --- dots/.config/nvim/lua/neovide.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dots/.config/nvim/lua/neovide.lua b/dots/.config/nvim/lua/neovide.lua index 816917a7..ad7ebe8c 100644 --- a/dots/.config/nvim/lua/neovide.lua +++ b/dots/.config/nvim/lua/neovide.lua @@ -30,5 +30,22 @@ vim.keymap.set({ "n" }, "", "vertical aboveleft terminal", { vim.keymap.set({ "n" }, "", "horizontal aboveleft terminal", { noremap = true, silent = true }) vim.keymap.set({ "n" }, "", "horizontal belowright terminal", { noremap = true, silent = true }) +-- Zoom in & out +vim.g.neovide_scale_factor = 1 +local change_scale_factor = function(delta) + vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta +end +vim.keymap.set("n", "", function() + change_scale_factor(1.1) +end, { silent = true, desc = "Neovide: Zoom In" }) + +vim.keymap.set("n", "", function() + change_scale_factor(1 / 1.1) +end, { noremap = true, silent = true, desc = "Neovide: Zoom out" }) + +vim.keymap.set("n", "", function() + vim.g.neovide_scale_factor = 1 +end, { noremap = true, silent = true, desc = "Neovide: Reset Zoom" }) + -- Set Neovide specific vars for use elsewhere (e.g. terminal sessions) vim.env.NEOVIDE_SESSION = 1