A simple session management plugin for Neovim. It uses
:mksession
to save and :source
to load working
directory based sessions.
Warning
This plugin is based on my personal needs. Work in progress. 🚀
Other better plugins are:
- Shatur/neovim-session-manager
- folke/persistence.nvim
- tpope/vim-obsession
- echasnovski/mini.sessions
- and many more ...
- Uses one session file per working directory
- Session files are stored global in
vim.fn.stdpath('data')
in a configurable subdirectory - Sessions are manually saved, loaded and deleted
- It ignores empty windows from plugins like nvim-tree or outline
(removes temporaryblank
from the:h sessionoptions
)
Tip
See :h sessionoptions
to change what is stored in the
session file with :mksession
.
- Neovim >= 0.10
return {
'tigion/nvim-sessions',
keys = {
{ '<Leader>ws', '<Cmd>Session save<CR>', desc = 'Save session (cwd)' },
{ '<Leader>wl', '<Cmd>Session load<CR>', desc = 'Load session (cwd)' },
},
opts = {},
}
The default options are:
{
-- The name of the subdirectory in `vim.fn.stdpath('data')`
-- where the sessions are saved.
-- If it does not exist, it will be created.
directory = 'sessions', ---@type string
-- Overwrites existing session files without confirmation.
overwrite = true, ---@type boolean
}
For other plugin manager, call the setup function
require('sessions').setup({ ... })
directly.
Command | Description |
---|---|
:Session |
Shows information about the current session and the Session command |
:Session save |
Saves the current session for the current working directory |
:Session load |
Loads the session for the current working directory |
:Session delete |
Deletes the session for the current working directory |
Run :checkhealth sessions
to check the health of the plugin.
- Move simple session management from tigion.core.util.session to a plugin.
- Update readme