mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-14 07:05:57 +01:00
53 lines
1.7 KiB
Nix
53 lines
1.7 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
with lib;
|
|
with builtins; let
|
|
cfg = config.vim.session.nvim-session-manager;
|
|
in {
|
|
config = mkIf cfg.enable {
|
|
vim.startPlugins =
|
|
[
|
|
"nvim-session-manager"
|
|
"plenary-nvim"
|
|
]
|
|
++ 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>";
|
|
# TODO: load_current_dir_session
|
|
};
|
|
|
|
vim.luaConfigRC.nvim-session-manager = nvim.dag.entryAnywhere ''
|
|
local Path = require('plenary.path')
|
|
local sm = require('session_manager.config')
|
|
require('session_manager').setup({
|
|
sessions_dir = Path:new(vim.fn.stdpath('data'), 'sessions'),
|
|
|
|
path_replacer = '${toString cfg.pathReplacer}',
|
|
|
|
colon_replacer = '${toString cfg.colonReplacer}',
|
|
|
|
autoload_mode = sm.AutoloadMode.${toString cfg.autoloadMode},
|
|
|
|
autosave_last_session = ${boolToString cfg.autoSave.lastSession},
|
|
|
|
autosave_ignore_not_normal = ${boolToString cfg.autoSave.ignoreNotNormal},
|
|
|
|
autosave_ignore_dirs = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreDirs)}},
|
|
|
|
autosave_ignore_filetypes = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreFiletypes)}},
|
|
|
|
autosave_ignore_buftypes = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreBufTypes)}},
|
|
|
|
autosave_only_in_session = ${boolToString cfg.autoSave.onlyInSession},
|
|
max_path_length = ${toString cfg.maxPathLength},
|
|
})
|
|
'';
|
|
};
|
|
}
|