Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tigion/nvim-sessions
A simple session management plugin for neovim.
https://github.com/tigion/nvim-sessions
lua neovim neovim-plugin
Last synced: about 1 month ago
JSON representation
A simple session management plugin for neovim.
- Host: GitHub
- URL: https://github.com/tigion/nvim-sessions
- Owner: tigion
- License: mit
- Created: 2024-08-21T12:37:08.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-24T09:54:31.000Z (3 months ago)
- Last Synced: 2024-09-27T18:21:58.160Z (about 2 months ago)
- Topics: lua, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nvim-sessions
A simple session management plugin for Neovim. It uses
[`:mksession`][mksession] to save and [`:source`][source] to load working
directory based sessions.[mksession]: https://neovim.io/doc/user/starting.html#%3Amksession
[sessionoptions]: https://neovim.io/doc/user/options.html#'sessionoptions'
[source]: https://neovim.io/doc/user/repeat.html#%3Asource> [!WARNING]
> This plugin is based on my personal needs. Work in progress. 🚀Other better plugins are:
- [Shatur/neovim-session-manager](https://github.com/Shatur/neovim-session-manager)
- [folke/persistence.nvim](https://github.com/folke/persistence.nvim)
- [tpope/vim-obsession](https://github.com/tpope/vim-obsession)
- [echasnovski/mini.sessions](https://github.com/echasnovski/mini.sessions)
- and many more ...## Features
- 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 temporary `blank` from the `:h sessionoptions`)> [!TIP]
> See [`:h sessionoptions`][sessionoptions] to change what is stored in the
> session file with `:mksession`.## Requirements
- Neovim >= 0.10
## Installation
### [lazy.nvim]
[lazy.nvim]: https://github.com/folke/lazy.nvim
```lua
return {
'tigion/nvim-sessions',
keys = {
{ 'ws', 'Session save', desc = 'Save session (cwd)' },
{ 'wl', 'Session load', desc = 'Load session (cwd)' },
},
opts = {},
}
```## Configuration
The default options are:
```lua
{
-- 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.## Usage
| 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.
## TODO
- [x] Move simple session management from tigion.core.util.session to a plugin.
- [x] Update readme