From 15185f9ad68eab67270aff627a1fa034b4404f21 Mon Sep 17 00:00:00 2001 From: n3oney Date: Tue, 11 Apr 2023 15:42:45 +0200 Subject: [PATCH] feat: add nvim-session-manager keybindings --- .../session/nvim-session-manager/config.nix | 12 +++++----- .../nvim-session-manager.nix | 23 +++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/modules/session/nvim-session-manager/config.nix b/modules/session/nvim-session-manager/config.nix index b2ce8b7b..a65b21ff 100644 --- a/modules/session/nvim-session-manager/config.nix +++ b/modules/session/nvim-session-manager/config.nix @@ -15,13 +15,13 @@ in { ] ++ optionals (cfg.usePicker) ["dressing-nvim"]; - vim.nnoremap = { - "sl" = ":SessionManager load_session"; - "sd" = ":SessionManager delete_session"; - "sc" = ":SessionManager save_current_session"; - "slt" = ":SessionManager load_last_session"; + vim.maps.normal = mkMerge [ + (mkBinding cfg.mappings.loadSession ":SessionManager load_session" "Load session") + (mkBinding cfg.mappings.deleteSession ":SessionManager delete_session" "Delete session") + (mkBinding cfg.mappings.saveCurrentSession ":SessionManager save_current_session" "Save current session") + (mkBinding cfg.mappings.loadLastSession ":SessionManager load_last_session" "Load last session") # TODO: load_current_dir_session - }; + ]; vim.luaConfigRC.nvim-session-manager = nvim.dag.entryAnywhere '' local Path = require('plenary.path') diff --git a/modules/session/nvim-session-manager/nvim-session-manager.nix b/modules/session/nvim-session-manager/nvim-session-manager.nix index 74ec434b..7f84c212 100644 --- a/modules/session/nvim-session-manager/nvim-session-manager.nix +++ b/modules/session/nvim-session-manager/nvim-session-manager.nix @@ -8,6 +8,29 @@ with builtins; { options.vim.session.nvim-session-manager = { enable = mkEnableOption "Enable nvim-session-manager"; + mappings = { + loadSession = mkOption { + type = types.nullOr types.str; + description = "Load session"; + default = "sl"; + }; + deleteSession = mkOption { + type = types.nullOr types.str; + description = "Delete session"; + default = "sd"; + }; + saveCurrentSession = mkOption { + type = types.nullOr types.str; + description = "Save current session"; + default = "sc"; + }; + loadLastSession = mkOption { + type = types.nullOr types.str; + description = "Load last session"; + default = "slt"; + }; + }; + usePicker = mkOption { type = types.bool; default = true;