feat: add nvim-session-manager keybindings

This commit is contained in:
n3oney 2023-04-11 15:42:45 +02:00
parent 5a56de1b9f
commit 15185f9ad6
No known key found for this signature in database
GPG key ID: C786693DE727850E
2 changed files with 29 additions and 6 deletions

View file

@ -15,13 +15,13 @@ in {
]
++ optionals (cfg.usePicker) ["dressing-nvim"];
vim.nnoremap = {
"<leader>sl" = ":SessionManager load_session<CR>";
"<leader>sd" = ":SessionManager delete_session<CR>";
"<leader>sc" = ":SessionManager save_current_session<CR>";
"<leader>slt" = ":SessionManager load_last_session<CR>";
vim.maps.normal = mkMerge [
(mkBinding cfg.mappings.loadSession ":SessionManager load_session<CR>" "Load session")
(mkBinding cfg.mappings.deleteSession ":SessionManager delete_session<CR>" "Delete session")
(mkBinding cfg.mappings.saveCurrentSession ":SessionManager save_current_session<CR>" "Save current session")
(mkBinding cfg.mappings.loadLastSession ":SessionManager load_last_session<CR>" "Load last session")
# TODO: load_current_dir_session
};
];
vim.luaConfigRC.nvim-session-manager = nvim.dag.entryAnywhere ''
local Path = require('plenary.path')

View file

@ -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 = "<leader>sl";
};
deleteSession = mkOption {
type = types.nullOr types.str;
description = "Delete session";
default = "<leader>sd";
};
saveCurrentSession = mkOption {
type = types.nullOr types.str;
description = "Save current session";
default = "<leader>sc";
};
loadLastSession = mkOption {
type = types.nullOr types.str;
description = "Load last session";
default = "<leader>slt";
};
};
usePicker = mkOption {
type = types.bool;
default = true;