From 7e67b345e9f502abcf7d48006d732f32e1b44616 Mon Sep 17 00:00:00 2001 From: Michael Flossmann Date: Thu, 22 Aug 2024 09:55:21 +0200 Subject: [PATCH] add cosmetic changes to comments and keybindings --- plugins/arrow.nix | 7 +++++++ plugins/heirline.nix | 2 +- plugins/lsp.nix | 8 ++++---- plugins/luasnip.nix | 15 +++++++++++++++ plugins/telescope.nix | 20 ++++++++++++++++++-- plugins/treesitter.nix | 9 +++++++-- plugins/which-key.nix | 37 ++++++++++++++----------------------- utils/_icons.nix | 3 ++- 8 files changed, 68 insertions(+), 33 deletions(-) diff --git a/plugins/arrow.nix b/plugins/arrow.nix index 6e7401c..6899cba 100644 --- a/plugins/arrow.nix +++ b/plugins/arrow.nix @@ -11,6 +11,13 @@ leader_key = ';', -- Recommended to be a single key buffer_leader_key = 'm', -- Per Buffer Mappings }) + + -- prewritten for later + -- require("which-key").add({ + -- {";", desc = "Arrow buffers"}, + -- {"m", desc = "Arrow marks"} + -- }) ''; }; + } diff --git a/plugins/heirline.nix b/plugins/heirline.nix index 3b57cdd..42056e7 100644 --- a/plugins/heirline.nix +++ b/plugins/heirline.nix @@ -8,7 +8,7 @@ # Config from AstroNvim # https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/heirline.lua # https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/configs/heirline.lua - config = '' + config = /*lua*/ '' local status = require("astroui.status") require("heirline").setup({ diff --git a/plugins/lsp.nix b/plugins/lsp.nix index 1c8b15f..7e26c5c 100644 --- a/plugins/lsp.nix +++ b/plugins/lsp.nix @@ -36,10 +36,10 @@ action = "rename"; desc = "Rename current symbol"; }; - "lR" = { - action = "rename"; - desc = "Search references"; - }; + # "lR" = { + # action = "references"; + # desc = "Search references"; + # }; "lh" = { action = "signature_help"; desc = "Signature help"; diff --git a/plugins/luasnip.nix b/plugins/luasnip.nix index 613d852..5f97d0a 100644 --- a/plugins/luasnip.nix +++ b/plugins/luasnip.nix @@ -6,4 +6,19 @@ _:{ { paths = "~/.config/snippets/"; } ]; }; + + rootOpts.keymaps = [ + { + mode = "i"; + key = ""; + action.__raw = ''function() require("luasnip").jump(1) end''; + options.desc = "Jump to next snippet node"; + } + { + mode = "i"; + key = ""; + action.__raw = ''function() require("luasnip").jump(-1) end''; + options.desc = "Jump to previous snippet node"; + } + ]; } diff --git a/plugins/telescope.nix b/plugins/telescope.nix index d15a11b..fb7482e 100644 --- a/plugins/telescope.nix +++ b/plugins/telescope.nix @@ -104,7 +104,7 @@ } { desc = "Find words"; - key = "fg"; + key = "fw"; fn = "live_grep"; } { @@ -147,15 +147,31 @@ key = "fC"; fn = "commands"; } + { + desc = "Find man"; + key = "fm"; + fn = "man_pages"; + } + { + desc = "Find words in all files"; + key = "fm"; + fn = "live_grep"; + args.additional_args.__raw = ''function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end''; + } { desc = "Find themes"; key = "ft"; - fn = "colortheme"; + fn = "colorscheme"; args = { enable_preview = true; ignore_builtins = true; }; } + { + desc = "Search diagnostics"; + key = "lD"; + fn = "diagnostics"; + } ]; }; } diff --git a/plugins/treesitter.nix b/plugins/treesitter.nix index 9ffd687..c966506 100644 --- a/plugins/treesitter.nix +++ b/plugins/treesitter.nix @@ -8,7 +8,12 @@ enable = true; # Enable treesitter based indentation (use '=' to auto-indent) - settings.indent.enable = true; + settings = { + indent.enable = true; + highlight = { + enable = true; + }; + }; # Workaround to enable incremental selection without setting default keymaps (keymaps are set globally) # This is needed in order to set custom descriptions and avoid to have multiple keymaps @@ -35,7 +40,7 @@ } { mode = [ "n" "x" "o" ]; - key = ";"; + key = "-"; action.__raw = "function() require('nvim-treesitter.textobjects.repeatable_move').repeat_last_move_opposite() end"; options.desc = "Repeat last move in the opposite direction"; } diff --git a/plugins/which-key.nix b/plugins/which-key.nix index 8215e8e..ae4c052 100644 --- a/plugins/which-key.nix +++ b/plugins/which-key.nix @@ -9,29 +9,20 @@ # Disable which-key when in neo-tree or telescope - settings = { - icons.group = ""; - window.border = "single"; - - # Customize section names (prefixed mappings) - spec = [ - { __unkeyed = "b"; group = "Buffers"; icon = icons.Tab; } - { __unkeyed = "bs"; group = "Sort Buffers"; icon = icons.Sort;} - { __unkeyed = "d"; group = "Debugger"; icon = icons.Debugger;} - { __unkeyed = "f"; group = "Find"; icon = icons.Search;} - { __unkeyed = "g"; group = "Git"; icon = icons.Git;} - { __unkeyed = "l"; group = "Language Tools"; icon = icons.ActiveLSP;} - { __unkeyed = "m"; group = " Markdown"; } - { __unkeyed = "s"; group = "Session"; icon = icons.Session;} - { __unkeyed = "t"; group = "Terminal"; icon = icons.Terminal;} - { __unkeyed = "u"; group = "UI/UX"; icon = icons.Window;} - ]; - - disable.ft = [ - "TelescopePrompt" - "neo-tree" - "neo-tree-popup" - ]; + # Customize section names (prefixed mappings) + registrations = { + "b".name = "${icons.Tab} Buffers"; + "bs".name = "${icons.Sort} Sort Buffers"; + "d".name = "${icons.Debugger} Debugger"; + "f".name = "${icons.Search} Find"; + "g".name = "${icons.Git} Git"; + "l".name = "${icons.ActiveLSP} Language Tools"; + "m".name = " Markdown"; + "s".name = "${icons.Session} Session"; + "t".name = "${icons.Terminal} Terminal"; + "u".name = "${icons.Window} UI/UX"; + ";".name = "Arrow buffers"; # This should move to arrow.nix when moving to which-key.add() + "m".name = "Arrow marks"; # This should move to arrow.nix when moving to which-key.add( }; diff --git a/utils/_icons.nix b/utils/_icons.nix index 97845ba..52d8ed6 100644 --- a/utils/_icons.nix +++ b/utils/_icons.nix @@ -41,7 +41,8 @@ GitSign = "▎"; GitStaged = "✓"; GitUnstaged = "✗"; - GitUntracked = "★"; + GitUntracked.__raw = "require('astroui').get_icon('GitUntracked')"; # TODO: this should be all the signs (or even a function) + # GitUntracked = "★"; LSPLoading1 = ""; LSPLoading2 = "󰀚"; LSPLoading3 = "";