From eb07e46c21ee884e01c1d87923b7568d31f64009 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 | 2 ++ utils/_icons.nix | 3 ++- 8 files changed, 56 insertions(+), 10 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 d88603b..946f361 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 @@ -33,7 +38,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 f87790f..6126a05 100644 --- a/plugins/which-key.nix +++ b/plugins/which-key.nix @@ -27,6 +27,8 @@ "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 = "";