From 3b26572913f42c540691ee385bb255b52228e448 Mon Sep 17 00:00:00 2001 From: triethyl Date: Thu, 7 Aug 2025 15:00:30 -0400 Subject: neovim: added namu and changed keys --- pkgs/custom-neovim/config/init.lua | 2 +- pkgs/custom-neovim/config/lua/completion.lua | 7 ++++--- pkgs/custom-neovim/config/lua/lsp.lua | 8 ++++---- pkgs/custom-neovim/config/lua/mappings.lua | 7 +++++++ pkgs/custom-neovim/config/lua/plugins/namu.lua | 1 + pkgs/custom-neovim/default.nix | 1 + pkgs/custom-neovim/design.md | 1 + pkgs/custom-neovim/git-plugins.nix | 10 ++++++++++ 8 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 pkgs/custom-neovim/config/lua/plugins/namu.lua diff --git a/pkgs/custom-neovim/config/init.lua b/pkgs/custom-neovim/config/init.lua index 7fa0669..9ae14b8 100644 --- a/pkgs/custom-neovim/config/init.lua +++ b/pkgs/custom-neovim/config/init.lua @@ -12,7 +12,6 @@ require("statusline") require("lsp") require("completion") --- Require plugin configs. -- UI Plugins: require("plugins.tabby") require("plugins.mini.clue") @@ -23,6 +22,7 @@ require("plugins.mini.files") require("plugins.dropbar") require("plugins.auto-session") require("plugins.gitsigns") +require("plugins.namu") -- LSP Plugins: require("plugins.actions-preview") diff --git a/pkgs/custom-neovim/config/lua/completion.lua b/pkgs/custom-neovim/config/lua/completion.lua index b690293..ce87340 100644 --- a/pkgs/custom-neovim/config/lua/completion.lua +++ b/pkgs/custom-neovim/config/lua/completion.lua @@ -37,8 +37,8 @@ cmp.setup({ end, }, mapping = { - [''] = cmp.mapping.select_prev_item(select_opts), - [''] = cmp.mapping.select_next_item(select_opts), + -- [''] = cmp.mapping.select_prev_item(select_opts), + -- [''] = cmp.mapping.select_next_item(select_opts), [''] = cmp.mapping.select_prev_item(select_opts), [''] = cmp.mapping.select_next_item(select_opts), @@ -47,6 +47,7 @@ cmp.setup({ [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.abort(), + -- [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm({select = true}), [''] = cmp.mapping.confirm({select = false}), @@ -74,7 +75,7 @@ cmp.setup({ elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then fallback() else - cmp.complete() + -- cmp.complete() end end, {'i', 's'}), diff --git a/pkgs/custom-neovim/config/lua/lsp.lua b/pkgs/custom-neovim/config/lua/lsp.lua index 7511004..a01758c 100644 --- a/pkgs/custom-neovim/config/lua/lsp.lua +++ b/pkgs/custom-neovim/config/lua/lsp.lua @@ -28,10 +28,10 @@ vim.api.nvim_create_autocmd('LspAttach', { -- LSP Pickers mapkey('n', "a", "Perform code action", ":lua require('actions-preview').code_actions()") - mapkey("n", "I", "Open workspace diagnostic picker", ":lua Snacks.picker.diagnostics()") - mapkey("n", "i", "Open diagnostic picker", [[:lua Snacks.picker.diagnostics_buffer()]]) - mapkey("n", "s", "Open symbol picker", ":lua Snacks.picker.lsp_symbols()") - mapkey("n", "S", "Open workspace symbol picker", ":lua Snacks.picker.lsp_workspace_symbols()") + -- mapkey("n", "I", "Open workspace diagnostic picker", ":Namu diagnostics") + mapkey("n", "i", "Open diagnostic picker", ":Namu diagnostics") + mapkey("n", "s", "Open symbol picker", ":Namu symbols") + mapkey("n", "S", "Open workspace symbol picker", ":Namu workspace") -- Goto Keys mapkey('n', 'gD', "Go to declaration", vim.lsp.buf.declaration) diff --git a/pkgs/custom-neovim/config/lua/mappings.lua b/pkgs/custom-neovim/config/lua/mappings.lua index c6ee242..0bcff87 100644 --- a/pkgs/custom-neovim/config/lua/mappings.lua +++ b/pkgs/custom-neovim/config/lua/mappings.lua @@ -17,6 +17,7 @@ mapkey("n", "p", "Open picker picker", ":lua Snacks.picker.pickers() mapkey("n", "'", "Open last picker", ":lua Snacks.picker.resume()") mapkey("n", "", "Open smart picker", ":lua Snacks.picker.smart()") mapkey("n", "z", "Open zoxide picker", ":lua Snacks.picker.zoxide()") +mapkey("n", "T", "Open treesitter picker", ":Namu treesitter") -- Tabs mapkey("n", "t", "Manage tabs", "") @@ -36,6 +37,12 @@ end) -- Windows mapkey("n", "w", "Manage windows", "") +-- Fix arrow keys in wincmd +-- mapkey("n", "", "Focus left", "lua vim.cmd.wincmd('h')") +-- mapkey("n", "", "Focus down", "lua vim.cmd.wincmd('j')") +-- mapkey("n", "", "Focus up", "lua vim.cmd.wincmd('k')") +-- mapkey("n", "", "Focus right", "lua vim.cmd.wincmd('l')") + -- Sessions mapkey("n", "m", "Manage sessions", "") mapkey("n", "mm", "Open session picker", ":Autosession search") diff --git a/pkgs/custom-neovim/config/lua/plugins/namu.lua b/pkgs/custom-neovim/config/lua/plugins/namu.lua new file mode 100644 index 0000000..82275b9 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/namu.lua @@ -0,0 +1 @@ +require("namu").setup() diff --git a/pkgs/custom-neovim/default.nix b/pkgs/custom-neovim/default.nix index 10ec541..67a5e46 100644 --- a/pkgs/custom-neovim/default.nix +++ b/pkgs/custom-neovim/default.nix @@ -22,6 +22,7 @@ in auto-session nvim-ts-autotag gitsigns-nvim + git-plugins.namu-nvim-git # Completion nvim-cmp diff --git a/pkgs/custom-neovim/design.md b/pkgs/custom-neovim/design.md index aa0cfb6..0bc2dcd 100644 --- a/pkgs/custom-neovim/design.md +++ b/pkgs/custom-neovim/design.md @@ -21,3 +21,4 @@ - make lazyvim launch with default shell bash - make mini.git run commands from cwd instead of git root - make all gaps in statusbar from a component +- make nix file autoindent work properly (maybe remove smartindent?) diff --git a/pkgs/custom-neovim/git-plugins.nix b/pkgs/custom-neovim/git-plugins.nix index 6e26e40..a956923 100644 --- a/pkgs/custom-neovim/git-plugins.nix +++ b/pkgs/custom-neovim/git-plugins.nix @@ -17,4 +17,14 @@ sha256 = "sha256-Zbs+Xd6kGfR+s/f6xhxXBdKJA2N4WqcJDPWVkGaM7S0="; }; }); # go back to regular which-key when this commit is merged: https://github.com/folke/which-key.nvim/pull/974 + namu-nvim-git = pkgs.vimUtils.buildVimPlugin { + name = "namu-nvim"; + version = "git"; + src = pkgs.fetchFromGitHub { + owner = "bassamsdata"; + repo = "namu.nvim"; + tag = "v0.6.0"; + sha256 = "sha256-ywKb/VVNSa/LtiQaSO2lqff2ujupIcc9P9AJg/p6mKw="; + }; + }; } -- cgit v1.2.3