SeshMgr.nvim is a session management plugin for Neovim to save and load sessions.
Introduction • Features • Installation • Configuration • Contributing • Related Projects
I made this plugin for myself, there are many other plugins that do the same thing, see related projects. The main difference is that this plugin is that the telescope integration lists session with timestamps and in order of last used.
Manually save and load sessions using commands or use telescope to manage sessions. By default, autosave is enabled to save the session when exiting Neovim. This can be disabled in the configuration.
Command | Description |
---|---|
:SessionSave |
Save the current session by current working directory (cwd). |
:SessionLoad {session_full_path} |
Load the given session path. |
:SessionLoadLast |
Load the last session. |
:SessionLoadCurrent |
Load session for current working directory if exists. |
:SessionDelete {session_full_path} |
Delete the given session. |
:SessionDeleteCurrent |
Delete the file associated with the current session. |
:SessionList |
List all session files. |
You can delete and load sessions using telescope.
<leader>js
to open telescope (configurable)<CR>
to load session.<C-d>
to delete session.
With folke/lazy.nvim
{
"mackeper/SeshMgr.nvim",
event = "VeryLazy",
opts = {},
-- optional keymappings
keys = {
{ "<leader>sl", "<CMD>SessionLoadLast<CR>", desc = "Load last session" },
{ "<leader>sc", "<CMD>SessionLoadCurrent<CR>", desc = "Load current session" },
{ "<leader>sL", "<CMD>SessionList<CR>", desc = "List sessions" },
{ "<leader>ss", "<CMD>SessionSave<CR>", desc = "Save session" },
},
}
You need to either have the opts
table or call the setup({})
function in your config.
To configure the plugin, pass a table to the setup function or in the case of lazy the opts table.
Example
require("seshmgr").setup({
session_dir = vim.fn.stdpath("data") .. "/my_sessions",
autosave = false,
telescope = {
enabled = false,
},
})
{
session_dir = vim.fn.stdpath("data") .. "/sessions",
session_name_delimiter = "!!",
session_windows_drive_delimiter = ";;",
autosave_events = { "ExitPre" },
autosave = true,
telescope = {
enabled = true,
keymap = "<leader>js",
},
}
See CONTRIBUTING.md