From ef309868a758ca7087c6d1ed1c8156172fe9b96a Mon Sep 17 00:00:00 2001 From: triethyl Date: Tue, 5 Aug 2025 21:37:07 -0400 Subject: neovim: moved to mini-pairs and cleaned up --- pkgs/custom-neovim/config/init.lua | 2 +- pkgs/custom-neovim/config/lua/mappings.lua | 10 +++ pkgs/custom-neovim/config/lua/plugins/alpha.lua | 32 -------- .../custom-neovim/config/lua/plugins/autopairs.lua | 1 - pkgs/custom-neovim/config/lua/plugins/lualine.lua | 88 ---------------------- .../config/lua/plugins/mini/pairs.lua | 1 + .../config/lua/plugins/mini/statusline.lua | 28 ------- pkgs/custom-neovim/config/lua/plugins/oil.lua | 11 --- .../custom-neovim/config/lua/plugins/persisted.lua | 4 - .../custom-neovim/config/lua/plugins/telescope.lua | 1 - pkgs/custom-neovim/config/lua/plugins/vimade.lua | 1 - .../custom-neovim/config/lua/plugins/which-key.lua | 10 --- pkgs/custom-neovim/default.nix | 1 - pkgs/custom-neovim/design.md | 5 +- 14 files changed, 13 insertions(+), 182 deletions(-) delete mode 100644 pkgs/custom-neovim/config/lua/plugins/alpha.lua delete mode 100644 pkgs/custom-neovim/config/lua/plugins/autopairs.lua delete mode 100644 pkgs/custom-neovim/config/lua/plugins/lualine.lua create mode 100644 pkgs/custom-neovim/config/lua/plugins/mini/pairs.lua delete mode 100644 pkgs/custom-neovim/config/lua/plugins/mini/statusline.lua delete mode 100644 pkgs/custom-neovim/config/lua/plugins/oil.lua delete mode 100644 pkgs/custom-neovim/config/lua/plugins/persisted.lua delete mode 100644 pkgs/custom-neovim/config/lua/plugins/telescope.lua delete mode 100644 pkgs/custom-neovim/config/lua/plugins/vimade.lua delete mode 100644 pkgs/custom-neovim/config/lua/plugins/which-key.lua (limited to 'pkgs/custom-neovim') diff --git a/pkgs/custom-neovim/config/init.lua b/pkgs/custom-neovim/config/init.lua index 3c1d03d..69c6852 100644 --- a/pkgs/custom-neovim/config/init.lua +++ b/pkgs/custom-neovim/config/init.lua @@ -27,7 +27,7 @@ require("plugins.actions-preview") -- Utility Plugins: require("plugins.mini.git") -require("plugins.autopairs") +require("plugins.mini.pairs") require("plugins.ts-autotag") -- Misc Plugins: diff --git a/pkgs/custom-neovim/config/lua/mappings.lua b/pkgs/custom-neovim/config/lua/mappings.lua index 8c670f4..ec5788b 100644 --- a/pkgs/custom-neovim/config/lua/mappings.lua +++ b/pkgs/custom-neovim/config/lua/mappings.lua @@ -74,6 +74,16 @@ mapkey({"n", "v"}, "x", "Really delete character", [["_x]]) mapkey({"n", "v"}, "j", "Go down visually", "gj") mapkey({"n", "v"}, "k", "Go up visually", "gk") +-- Exit neovim +mapkey("n", "q", "Save and exit neovim", function() + vim.cmd("wa!") + vim.cmd("qa!") +end) + +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) diff --git a/pkgs/custom-neovim/config/lua/plugins/alpha.lua b/pkgs/custom-neovim/config/lua/plugins/alpha.lua deleted file mode 100644 index 32130f8..0000000 --- a/pkgs/custom-neovim/config/lua/plugins/alpha.lua +++ /dev/null @@ -1,32 +0,0 @@ -local alpha = require("alpha") -local dashboard = require("alpha.themes.dashboard") - --- Set header -dashboard.section.header.val = Art.misc.hydra - --- Set menu -dashboard.section.buttons.val = { - dashboard.button( "f", " > Find file", ":cd $HOME | Telescope find_files" ), - dashboard.button( "r", " > Find recent file", ":Telescope oldfiles" ), - dashboard.button( "s", " > Load session", ":Telescope persisted" ), - dashboard.button( "l", " > Load last session", ":SessionLoadLast" ), - dashboard.button( "q", " > Quit", ":qa" ), -} - --- Center components. -dashboard.section.header.opts.position = "center" -dashboard.section.footer.opts.position = "center" - --- Send config to alpha -alpha.setup(dashboard.opts) - --- Set options just for the dashboard. -vim.api.nvim_create_autocmd("BufEnter", { - pattern = "alpha", - callback = function() - vim.opt_local.foldenable = false -- disable folding - vim.opt_local.relativenumber = false - vim.opt_local.number = false - end, -}) - diff --git a/pkgs/custom-neovim/config/lua/plugins/autopairs.lua b/pkgs/custom-neovim/config/lua/plugins/autopairs.lua deleted file mode 100644 index ba62d44..0000000 --- a/pkgs/custom-neovim/config/lua/plugins/autopairs.lua +++ /dev/null @@ -1 +0,0 @@ -require("nvim-autopairs").setup {} diff --git a/pkgs/custom-neovim/config/lua/plugins/lualine.lua b/pkgs/custom-neovim/config/lua/plugins/lualine.lua deleted file mode 100644 index 1726f67..0000000 --- a/pkgs/custom-neovim/config/lua/plugins/lualine.lua +++ /dev/null @@ -1,88 +0,0 @@ -local generate_lualine_theme = function() - local colors = Utils.generate_theme_from_highlight_groups() - return { - normal = { - a = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.background, fg = colors.text.light}, - c = {bg = colors.background, fg = colors.text.light}, - x = {bg = colors.background, fg = colors.text.light}, - y = {bg = colors.background, fg = colors.text.light}, - z = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, - }, - insert = { - a = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.background, fg = colors.text.light}, - c = {bg = colors.background, fg = colors.text.light}, - x = {bg = colors.background, fg = colors.text.light}, - y = {bg = colors.background, fg = colors.text.light}, - z = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, - }, - visual = { - a = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.background, fg = colors.text.light}, - c = {bg = colors.background, fg = colors.text.light}, - x = {bg = colors.background, fg = colors.text.light}, - y = {bg = colors.background, fg = colors.text.light}, - z = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, - }, - replace = { - a = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.background, fg = colors.text.light}, - c = {bg = colors.background, fg = colors.text.light}, - x = {bg = colors.background, fg = colors.text.light}, - y = {bg = colors.background, fg = colors.text.light}, - z = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, - }, - command = { - a = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.background, fg = colors.text.light}, - c = {bg = colors.background, fg = colors.text.light}, - x = {bg = colors.background, fg = colors.text.light}, - y = {bg = colors.background, fg = colors.text.light}, - z = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, - }, - inactive = { - a = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, - b = {bg = colors.background, fg = colors.text.light}, - c = {bg = colors.background, fg = colors.text.light}, - x = {bg = colors.background, fg = colors.text.light}, - y = {bg = colors.background, fg = colors.text.light}, - z = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, - }, - }; -end - -require('lualine').setup { - options = { - theme = generate_lualine_theme(), - component_separators = "", - section_separators = { left = '', right = '' }, - }, - sections = { - lualine_a = { { 'mode', separator = { left = '', rignt = '' }, right_padding = 2 } }, -- { left = '', rignt = '' } - lualine_b = { 'filename', 'diff' }, - lualine_c = { 'branch' }, - lualine_x = { {'diagnostics', sources = { 'nvim_lsp' } } }, - lualine_y = { 'lsp_status', 'progress' }, - lualine_z = { - { 'location', separator = { left = '', right = '' }, left_padding = 2 }, - }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = { 'filename' }, - lualine_c = {}, - lualine_x = {}, - lualine_y = { 'location' }, - lualine_z = {}, - }, - tabline = {}, - extensions = {}, -} - --- vim.api.nvim_create_autocmd("ColorScheme", { --- callback = function() --- setup_lualine() --- print "colorscheme changed" --- end, --- }) diff --git a/pkgs/custom-neovim/config/lua/plugins/mini/pairs.lua b/pkgs/custom-neovim/config/lua/plugins/mini/pairs.lua new file mode 100644 index 0000000..493c4d0 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/mini/pairs.lua @@ -0,0 +1 @@ +require("mini.pairs").setup() diff --git a/pkgs/custom-neovim/config/lua/plugins/mini/statusline.lua b/pkgs/custom-neovim/config/lua/plugins/mini/statusline.lua deleted file mode 100644 index e5931a2..0000000 --- a/pkgs/custom-neovim/config/lua/plugins/mini/statusline.lua +++ /dev/null @@ -1,28 +0,0 @@ -require("mini.statusline").setup() - -MiniStatusline.config = { - content = { - active = function() - local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 }) - local git = MiniStatusline.section_git({ trunc_width = 40 }) - local diff = MiniStatusline.section_diff({ trunc_width = 75 }) - local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 }) - local lsp = MiniStatusline.section_lsp({ trunc_width = 75 }) - local filename = MiniStatusline.section_filename({ trunc_width = 140 }) - local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 }) - local location = MiniStatusline.section_location({ trunc_width = 75 }) - local search = MiniStatusline.section_searchcount({ trunc_width = 75 }) - - return MiniStatusline.combine_groups({ - { hl = mode_hl, strings = { mode } }, - { hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } }, - '%<', -- Mark general truncate point - { hl = 'MiniStatuslineFilename', strings = { filename } }, - '%=', -- End left alignment - { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } }, - { hl = mode_hl, strings = { search, location } }, - }) - end - }, - use_icons = true, -} diff --git a/pkgs/custom-neovim/config/lua/plugins/oil.lua b/pkgs/custom-neovim/config/lua/plugins/oil.lua deleted file mode 100644 index 6682599..0000000 --- a/pkgs/custom-neovim/config/lua/plugins/oil.lua +++ /dev/null @@ -1,11 +0,0 @@ -require('oil').setup { - win_options = { - wrap = true, - }, - skip_confirm_for_simple_edits = true, - watch_for_changes = true, - float = { - max_width = 0.6, - max_height = 0.8, - }, -} diff --git a/pkgs/custom-neovim/config/lua/plugins/persisted.lua b/pkgs/custom-neovim/config/lua/plugins/persisted.lua deleted file mode 100644 index 043c130..0000000 --- a/pkgs/custom-neovim/config/lua/plugins/persisted.lua +++ /dev/null @@ -1,4 +0,0 @@ -require("persisted").setup { - autostart = true, - autoload = true, -} diff --git a/pkgs/custom-neovim/config/lua/plugins/telescope.lua b/pkgs/custom-neovim/config/lua/plugins/telescope.lua deleted file mode 100644 index be3366b..0000000 --- a/pkgs/custom-neovim/config/lua/plugins/telescope.lua +++ /dev/null @@ -1 +0,0 @@ -require("telescope").setup() diff --git a/pkgs/custom-neovim/config/lua/plugins/vimade.lua b/pkgs/custom-neovim/config/lua/plugins/vimade.lua deleted file mode 100644 index 692e0ef..0000000 --- a/pkgs/custom-neovim/config/lua/plugins/vimade.lua +++ /dev/null @@ -1 +0,0 @@ -require("vimade").setup {} diff --git a/pkgs/custom-neovim/config/lua/plugins/which-key.lua b/pkgs/custom-neovim/config/lua/plugins/which-key.lua deleted file mode 100644 index 3d31fa7..0000000 --- a/pkgs/custom-neovim/config/lua/plugins/which-key.lua +++ /dev/null @@ -1,10 +0,0 @@ -require("which-key").setup { - preset = "helix", - delay = 0, -} - --- Show hydra mode for changing windows --- require("which-key").show({ --- keys = {"", modes = {"n"}}, --- loop = true, -- this will keep the popup open until you hit --- }) diff --git a/pkgs/custom-neovim/default.nix b/pkgs/custom-neovim/default.nix index c9049f6..f1c6183 100644 --- a/pkgs/custom-neovim/default.nix +++ b/pkgs/custom-neovim/default.nix @@ -23,7 +23,6 @@ in # oil-nvim dropbar-nvim auto-session - nvim-autopairs nvim-ts-autotag # Colorschemes diff --git a/pkgs/custom-neovim/design.md b/pkgs/custom-neovim/design.md index 431a556..2ba7e31 100644 --- a/pkgs/custom-neovim/design.md +++ b/pkgs/custom-neovim/design.md @@ -11,15 +11,12 @@ ## Todo - add quick window switcher plugin -- add smart indentation - make tabby run on highlight groups - add modified tags to tabby - add gitsigns -- base statusline git branch on gitsigns +- rebase statusline git branch on gitsigns - add git status to statusline -- dim unfocused windows - prevent dropbar filename from truncating - add keybind to activate dropbar drop down menu - add good git keybinds - find dropbar load autocommand and modify to work on winenter to prevent no dropbar when splitting -- make statusline diagnostics only appear in normal mode -- cgit v1.2.3