diff --git a/modules/editor/vim.nix b/modules/editor/vim.nix index d80d5a5..c5dcdce 100644 --- a/modules/editor/vim.nix +++ b/modules/editor/vim.nix @@ -372,6 +372,12 @@ in { key = ">"; action = ">gv"; } + { + mode = "n"; + key = "qq"; + action = "qa"; + options.desc = "Quit All"; + } ]; plugins = { @@ -475,14 +481,14 @@ in { vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc}) end - map("n", "h;", function() + map("n", "g;", function() if vim.wo.diff then vim.cmd.normal({ "]c", bang = true }) else gs.nav_hunk("next") end end, "Next Hunk") - map("n", "h,", function() + map("n", "g,", function() if vim.wo.diff then vim.cmd.normal({ "[c", bang = true }) else @@ -641,6 +647,7 @@ in { ['s'] = { name = 'Search', _ = 'which_key_ignore' }, ['w'] = { name = 'Window', _ = 'which_key_ignore' }, ['t'] = { name = 'Toggle', _ = 'which_key_ignore' }, + ['q'] = { name = 'Quit/Session', _ = 'which_key_ignore' }, } end ''; @@ -792,6 +799,20 @@ in { } ''; } + { + pkg = pkgs.unstable.vimPlugins.persistence-nvim; + event = "BufReadPre"; + opts.__raw = /*lua*/ '' + { options =vim.opt.sessionoptions:get() } + ''; + keys.__raw = /*lua*/ '' + { + { "qs", function() require("persistence").load() end, desc = "Restore Session" }, + { "ql", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" }, + { "qd", function() require("persistence").stop() end, desc = "Don't Save Current Session" }, + } + ''; + } # Disabled for now as it tries to write org grammar to its own directory in the nix store # https://github.com/nvim-orgmode/orgmode/blob/95fb795a422f0455e03d13a3f83525f1d00793ad/lua/orgmode/utils/treesitter/install.lua#L9