]> localhost Git - nvim.git/commitdiff
feat: font adjustments keybindings
authorJansen <[email protected]>
Wed, 6 Nov 2024 14:43:03 +0000 (10:43 -0400)
committerJansen <[email protected]>
Wed, 6 Nov 2024 14:43:03 +0000 (10:43 -0400)
init.lua

index 8731e1bff3a6982de6b6cd418648f8a4a4cdf0a3..57dc1546616ad7b74f30be27c08f4039f527e928 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -20,13 +20,22 @@ vim.g.netrw_liststyle = 1
 local tab_next = true
 
 -- Neovide =====================================================================
+local font_family = "Iosevka NF"
+local font_size = 18
+local min_font_size = 4
+local max_font_size = 40
+
+local function font()
+  return font_family .. ":h" .. font_size
+end
+
 if vim.g.neovide then
   vim.g.neovide_hide_mouse_when_typing = true
 
   vim.g.neovide_padding_left = 10
   vim.g.neovide_padding_right = 10
 
-  vim.o.guifont = "Iosevka NF:h12"
+  vim.o.guifont = font()
   vim.opt.linespace = 0
 
   vim.cmd [[cd ~]]
@@ -114,7 +123,6 @@ require("lazy").setup({
       local automatic = {
         "clangd",
         "zls",
-        "dartls",
       }
 
       -- Install LSPs
@@ -201,7 +209,8 @@ require("lazy").setup({
 
 -- CustomCommands ==============================================================
 local function edit_config()
-  vim.cmd [[e ~/.config/nvim/init.lua]]
+  vim.cmd [[cd ~/.config/nvim]]
+  vim.cmd [[e init.lua]]
 end
 vim.api.nvim_create_user_command('Econfig', edit_config, {})
 
@@ -219,6 +228,17 @@ end
 vim.keymap.set('n', '<leader>H', function() vim.cmd [[nohl]] end)
 vim.keymap.set('n', '<leader>`', function() vim.cmd [[Neogit]] end)
 
+vim.keymap.set('n', '<leader>-', function()
+  font_size = font_size-vim.v.count1
+  if font_size < min_font_size then font_size = min_font_size end
+  vim.o.guifont = font()
+end)
+vim.keymap.set('n', '<leader>=', function()
+  font_size = font_size+vim.v.count1
+  if font_size > max_font_size then font_size = max_font_size end
+  vim.o.guifont = font()
+end)
+
 vim.keymap.set('n', '<leader>[', function()
   if (vim.api.nvim_get_option_value("number", {})) then
     vim.api.nvim_set_option_value("number", false, {})