From e292b5bd5ba856925d7422f8d251970abafc59b5 Mon Sep 17 00:00:00 2001 From: triethyl Date: Mon, 11 Aug 2025 18:53:49 -0400 Subject: neovim: automatic split resizing and cleanup --- pkgs/custom-neovim/config/init.lua | 1 - pkgs/custom-neovim/config/lua/autocommands.lua | 18 ++++++------------ pkgs/custom-neovim/config/lua/mappings.lua | 17 ++++++++++++----- pkgs/custom-neovim/config/lua/options.lua | 4 ++-- pkgs/custom-neovim/config/lua/plugins/focus.lua | 4 ++++ pkgs/custom-neovim/default.nix | 1 + pkgs/custom-neovim/design.md | 6 ++++++ 7 files changed, 31 insertions(+), 20 deletions(-) (limited to 'pkgs/custom-neovim') diff --git a/pkgs/custom-neovim/config/init.lua b/pkgs/custom-neovim/config/init.lua index 3a0cf6b..c3df542 100644 --- a/pkgs/custom-neovim/config/init.lua +++ b/pkgs/custom-neovim/config/init.lua @@ -17,7 +17,6 @@ require("plugins.mini.tabline") require("plugins.mini.clue") require("plugins.mini.indentscope") require("plugins.fidget") -require("plugins.mini.cursorword") require("plugins.treesitter") require("plugins.mini.files") require("plugins.dropbar") diff --git a/pkgs/custom-neovim/config/lua/autocommands.lua b/pkgs/custom-neovim/config/lua/autocommands.lua index a09c5dd..c452696 100644 --- a/pkgs/custom-neovim/config/lua/autocommands.lua +++ b/pkgs/custom-neovim/config/lua/autocommands.lua @@ -1,15 +1,9 @@ -- Autocommands --- start terminal in insert mode --- vim.api.nvim_create_autocmd("TermOpen", { --- callback = function() --- vim.cmd "startinsert!" --- end, --- }) - -- Equalize Splits when resized --- vim.api.nvim_create_autocmd({"VimResized", "WinEnter"}, { --- callback = function() --- vim.cmd.wincmd("=") --- end, --- }) +vim.api.nvim_create_autocmd({"VimResized"}, { + callback = function() + -- vim.cmd.wincmd("=") + vim.cmd("FocusAutoresize") + end, +}) diff --git a/pkgs/custom-neovim/config/lua/mappings.lua b/pkgs/custom-neovim/config/lua/mappings.lua index 8648ff3..275ff27 100644 --- a/pkgs/custom-neovim/config/lua/mappings.lua +++ b/pkgs/custom-neovim/config/lua/mappings.lua @@ -38,6 +38,10 @@ mapkey("n", "bg", "Open buffer live grep picker", ":lua Snacks.picker.gr -- Windows mapkey("n", "w", "Manage windows", "") +mapkey("n", "S", "Open new horizontally", ":new") +mapkey("n", "wS", "Open new horizontally", ":new") +mapkey("n", "V", "Open new vertically", ":vnew") +mapkey("n", "wV", "Open new vertically", ":vnew") -- Sessions mapkey("n", "m", "Manage sessions", "") @@ -88,8 +92,11 @@ mapkey("n", "Q", "Exit neovim", function() vim.cmd("qa!") end) --- Learn hjkl. --- mapkey({"n", "v"}, "", "Correct the keypress", function() print("Try pressing h instead.") end) --- mapkey({"n", "v"}, "", "Correct the keypress", function() print("Try pressing j instead.") end) --- mapkey({"n", "v"}, "", "Correct the keypress", function() print("Try pressing k instead.") end) --- mapkey({"n", "v"}, "", "Correct the keypress", function() print("Try pressing l instead.") end) +-- Dimming +mapkey("n", "u", "Toggle scope dimming", function() + if Snacks.dim.enabled then + Snacks.dim.disable() + else + Snacks.dim.enable() + end +end) diff --git a/pkgs/custom-neovim/config/lua/options.lua b/pkgs/custom-neovim/config/lua/options.lua index 296aea3..3899c17 100644 --- a/pkgs/custom-neovim/config/lua/options.lua +++ b/pkgs/custom-neovim/config/lua/options.lua @@ -12,8 +12,8 @@ vim.o.number = true -- set absolute numbered lines vim.o.scrolloff = 4 -- minimal number of screen lines to keep above and below the cursor vim.o.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time vim.o.clipboard = "unnamedplus" -- use system clipboard -vim.o.equalalways = true -- equalize splits -vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" +-- vim.o.equalalways = true -- equalize splits +vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,globals" -- Split Behavior vim.o.splitright = true diff --git a/pkgs/custom-neovim/config/lua/plugins/focus.lua b/pkgs/custom-neovim/config/lua/plugins/focus.lua index f7afcd5..915603e 100644 --- a/pkgs/custom-neovim/config/lua/plugins/focus.lua +++ b/pkgs/custom-neovim/config/lua/plugins/focus.lua @@ -3,4 +3,8 @@ require("focus").setup { split = { bufnew = true, }, + ui = { + winhighlight = true, -- Highlight focused and unfocused windows + signcolumn = false, -- Signcolumn on all windows + }, } diff --git a/pkgs/custom-neovim/default.nix b/pkgs/custom-neovim/default.nix index 3ed6aee..78d09c9 100644 --- a/pkgs/custom-neovim/default.nix +++ b/pkgs/custom-neovim/default.nix @@ -27,6 +27,7 @@ in comment-nvim fidget-nvim focus-nvim + render-markdown-nvim # Completion nvim-cmp diff --git a/pkgs/custom-neovim/design.md b/pkgs/custom-neovim/design.md index b54e944..9e9f86f 100644 --- a/pkgs/custom-neovim/design.md +++ b/pkgs/custom-neovim/design.md @@ -12,6 +12,12 @@ - find dropbar load autocommand and modify to work on winenter to prevent no dropbar when splitting - make lazyvim launch with default shell bash +- make completion not work in pickers (namu, snacks) +- make mini scope not work in terminal or help windows +- make mini tabline compatible with more colorschemes +- make custom carbon colorscheme +- add quick window switch plugin +- switch to maple mono font ## Todo if possible - make splits automatically equalize when window resized -- cgit v1.2.3