From 9fbc5796847b17daf2a4bb6985e2529057e9bf1e Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sun, 9 Jun 2024 14:55:12 -0400 Subject: [PATCH] nvim: split off neovide config --- src/.config/nvim/lua/frontend.lua | 45 +++++++++++++++++++++++++++++++ src/.config/nvim/lua/init.lua | 1 + src/.config/nvim/lua/theme.lua | 41 ---------------------------- 3 files changed, 46 insertions(+), 41 deletions(-) create mode 100644 src/.config/nvim/lua/frontend.lua diff --git a/src/.config/nvim/lua/frontend.lua b/src/.config/nvim/lua/frontend.lua new file mode 100644 index 0000000..d90f8f1 --- /dev/null +++ b/src/.config/nvim/lua/frontend.lua @@ -0,0 +1,45 @@ +-------------------------------- +-------------------------------- +-- gui frontend settings +-------------------------------- +-------------------------------- + +vim.o.guifont = "JetBrains Mono:h10" + +if vim.g.neovide then + local confutil = require("confutil") + local keymap = confutil.keymap + + vim.g.neovide_padding_top = 8 + vim.g.neovide_padding_bottom = 8 + vim.g.neovide_padding_left = 8 + vim.g.transparency = 0 + vim.g.neovide_background_color = "#000000" .. 0 + + vim.g.neovide_cursor_animate_in_insert_mode = false + + -- hack to unscrew the scaling issues + -- sometimes opening neovide on a tiling wm makes it not occupy the entire window until resized + vim.api.nvim_create_augroup("NeovideScale", {}) + vim.api.nvim_create_autocmd( + "FocusGained", + { + group = "NeovideScale", + once = true, + callback = function() + vim.g.neovide_scale_factor = 1.01 + vim.uv.new_timer():start(40, 0, vim.schedule_wrap(function() + vim.g.neovide_scale_factor = 1 + end)) + end, + } + ) + + -- no terminal, no Ctrl-Shift-V paste + keymap("", '"+p', { mode = { "n", "i" } }) + + -- "new-term" in working directory + keymap("", function() + vim.system({ 'alacritty' }, { detach = true }) + end, { mode = { "n", "i", "v", "t" } }) +end diff --git a/src/.config/nvim/lua/init.lua b/src/.config/nvim/lua/init.lua index 5b87022..33787d2 100644 --- a/src/.config/nvim/lua/init.lua +++ b/src/.config/nvim/lua/init.lua @@ -41,6 +41,7 @@ keymap("eb", "Telescope keymaps") -------------------------------- -------------------------------- +require("frontend") require("theme") require("snippets") diff --git a/src/.config/nvim/lua/theme.lua b/src/.config/nvim/lua/theme.lua index 8f340e7..d267e1b 100644 --- a/src/.config/nvim/lua/theme.lua +++ b/src/.config/nvim/lua/theme.lua @@ -1,6 +1,3 @@ -local confutil = require("confutil") -local keymap = confutil.keymap - ------ -- color theme ------ @@ -87,41 +84,3 @@ Group.link("DapUIType", groups["@type.builtin"]) Group.link("DapUIVariable", groups["@variable"]) Group.link("DapUIValue", groups["@number"]) Group.link("DapUIFloatBorder", groups.FloatBorder) - --------------------------------- --------------------------------- --- gui frontend settings --------------------------------- --------------------------------- - -vim.o.guifont = "JetBrains Mono:h10" - -if vim.g.neovide then - vim.g.neovide_padding_top = 8 - vim.g.neovide_padding_bottom = 8 - vim.g.neovide_padding_left = 8 - vim.g.transparency = 0 - vim.g.neovide_background_color = "#000000" .. 0 - - vim.g.neovide_cursor_animate_in_insert_mode = false - - -- hack to unscrew the scaling issues - -- sometimes opening neovide on a tiling wm makes it not occupy the entire window until resized - vim.api.nvim_create_augroup("NeovideScale", {}) - vim.api.nvim_create_autocmd( - "FocusGained", - { - group = "NeovideScale", - once = true, - callback = function() - vim.g.neovide_scale_factor = 1.01 - vim.uv.new_timer():start(40, 0, vim.schedule_wrap(function() - vim.g.neovide_scale_factor = 1 - end)) - end, - } - ) - - -- no terminal, no Ctrl-Shift-V paste - keymap("", '"+p', { mode = { "n", "i" } }) -end