From 1677fceed9b14ea629630a02191fb2dbe85bee5a Mon Sep 17 00:00:00 2001 From: Nicolas Goudry Date: Fri, 7 Jun 2024 22:51:48 +0200 Subject: [PATCH] refactor(plugins/astrocore): move some settings out of plugin --- {plugins/astrocore => config}/autocmds.nix | 0 config/keymaps.nix | 35 -- config/keymaps/buffers.nix | 164 ++++++ config/keymaps/default.nix | 10 + config/keymaps/diagnostics.nix | 44 ++ config/keymaps/splits.nix | 44 ++ config/keymaps/standard.nix | 97 ++++ config/keymaps/tabs.nix | 24 + config/keymaps/terminal.nix | 28 + config/keymaps/toggles.nix | 164 ++++++ config/options.nix | 122 +++++ plugins/astrocore/default.nix | 14 +- plugins/astrocore/mappings.nix | 575 --------------------- plugins/astrocore/options.nix | 162 +----- plugins/which-key.nix | 15 +- 15 files changed, 720 insertions(+), 778 deletions(-) rename {plugins/astrocore => config}/autocmds.nix (100%) delete mode 100644 config/keymaps.nix create mode 100644 config/keymaps/buffers.nix create mode 100644 config/keymaps/default.nix create mode 100644 config/keymaps/diagnostics.nix create mode 100644 config/keymaps/splits.nix create mode 100644 config/keymaps/standard.nix create mode 100644 config/keymaps/tabs.nix create mode 100644 config/keymaps/terminal.nix create mode 100644 config/keymaps/toggles.nix delete mode 100644 plugins/astrocore/mappings.nix diff --git a/plugins/astrocore/autocmds.nix b/config/autocmds.nix similarity index 100% rename from plugins/astrocore/autocmds.nix rename to config/autocmds.nix diff --git a/config/keymaps.nix b/config/keymaps.nix deleted file mode 100644 index 02c27a6..0000000 --- a/config/keymaps.nix +++ /dev/null @@ -1,35 +0,0 @@ -let - forceWrite = { - action = "silent! update! | redraw"; - options.desc = "Force write"; - }; -in -{ - keymaps = [ - { - key = "n"; - action = "enew"; - options.desc = "New file"; - } - { - inherit (forceWrite) action options; - key = ""; - } - { - inherit (forceWrite) options; - mode = [ "i" "x" ]; - key = ""; - action = "${forceWrite.action}"; - } - { - key = "|"; - action = "vsplit"; - options.desc = "Split vertically"; - } - { - key = "\\"; - action = "split"; - options.desc = "Split horizontally"; - } - ]; -} diff --git a/config/keymaps/buffers.nix b/config/keymaps/buffers.nix new file mode 100644 index 0000000..c835db8 --- /dev/null +++ b/config/keymaps/buffers.nix @@ -0,0 +1,164 @@ +# Manage buffers +# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L56-L89 +[ + { + key = "c"; + options.desc = "Close buffer"; + + action.__raw = '' + function() + require("astrocore.buffer").close() + end + ''; + } + { + key = "C"; + options.desc = "Force close buffer"; + + action.__raw = '' + function() + require("astrocore.buffer").close(0, true) + end + ''; + } + { + key = "]b"; + options.desc = "Next buffer in tabline"; + + action.__raw = '' + function() + require("astrocore.buffer").nav(vim.v.count1) + end + ''; + } + { + key = "[b"; + options.desc = "Previous buffer in tabline"; + + action.__raw = '' + function() + require("astrocore.buffer").nav(-vim.v.count1) + end + ''; + } + { + key = ">b"; + options.desc = "Move buffer tab right"; + + action.__raw = '' + function() + require("astrocore.buffer").move(vim.v.count1) + end + ''; + } + { + key = " to load help for given