diff --git a/lazy-lock.json b/lazy-lock.json index 12108cd4..bab5a8f3 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -38,6 +38,7 @@ "nvim-treesitter-textobjects": { "branch": "master", "commit": "d816761ec1ea4a605689bc5f4111088459cf74d4" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "4a42b30376c1bd625ab5016c2079631d531d797a" }, "nvim-web-devicons": { "branch": "master", "commit": "05e1072f63f6c194ac6e867b567e6b437d3d4622" }, + "persistence.nvim": { "branch": "main", "commit": "5da6ddd077a63c4ba3b6d7c7ba53b7c7e6530715" }, "plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" }, "telescope.nvim": { "branch": "master", "commit": "b79cd6c88b3d96b0f49cb7d240807cd59b610cd8" }, "tokyonight.nvim": { "branch": "main", "commit": "63879369ac45e1dfe14c541d630e59240a6f2d4a" }, diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 5915649a..184dc789 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -65,5 +65,8 @@ vim.keymap.set("n", "gG", function() util.float_term({ "lazygit" }, { cwd = util.get_root() }) end, { desc = "Lazygit for root dir" }) +-- quit +vim.keymap.set("n", "qq", "qa", { desc = "Quit all" }) + -- highlights under cursor vim.keymap.set("n", "hl", vim.show_pos, { desc = "Highlight Groups at cursor" }) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 5d52fc78..05388f3b 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -147,6 +147,7 @@ return { ["g"] = { name = "+git" }, ["h"] = { name = "+help" }, ["n"] = { name = "+noice" }, + ["q"] = { name = "+quit/session" }, ["s"] = { name = "+search" }, ["x"] = { name = "+diagnostics" }, }) diff --git a/lua/lazyvim/plugins/util.lua b/lua/lazyvim/plugins/util.lua index 785cbb1a..8dc30855 100644 --- a/lua/lazyvim/plugins/util.lua +++ b/lua/lazyvim/plugins/util.lua @@ -9,6 +9,36 @@ return { end, }, + -- session management + { + "folke/persistence.nvim", + event = "BufReadPre", + config = { options = { "buffers", "curdir", "tabpages", "winsize", "help" } }, + keys = { + { + "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 = "Delete Current Session", + }, + }, + }, + -- library used by other plugins "nvim-lua/plenary.nvim", }