Skip to content

mackeper/SeshMgr.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SeshMgr.nvim

SeshMgr.nvim is a session management plugin for Neovim to save and load sessions.

Logo

Docs Tests

IntroductionFeaturesInstallationConfigurationContributingRelated Projects

Introduction 👋

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.

Features ✨

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.

Commands ⌨️

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.

Telescope 🔭

You can delete and load sessions using telescope.

  • <leader>js to open telescope (configurable)
    • <CR> to load session.
    • <C-d> to delete session.

Installation 📦

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.

Configuration ⚙️

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,
    },
})

Default configuration

{
    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",
    },
}

Contributing 🎉

See CONTRIBUTING.md

Related Projects 🔗