|
1 | 1 | # Neovim Session Manager |
2 | 2 |
|
3 | | -A Neovim plugin that use built-in `:mksession` to manage sessions like folders in VSCode. It allows you to save the current folder as a session to open it later. The plugin can also automatically load the last session on startup, save the current one on exit and switch between session folders. |
| 3 | +A Neovim plugin that use built-in `:mksession`/[resession.nvim](https://github.com/stevearc/resession.nvim) to manage sessions like folders in VSCode. It allows you to save the current folder as a session to open it later. The plugin can also automatically load the last session on startup, save the current one on exit and switch between session folders. |
4 | 4 |
|
5 | 5 | The plugin saves the sessions in the specified folder (see [configuration](#configuration)). The session corresponds to the working directory. If a session already exists for the current folder, it will be overwritten. |
6 | 6 |
|
7 | 7 | ## Dependencies |
8 | 8 |
|
9 | 9 | - [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) for internal helpers. |
| 10 | +- [resession.nvim](https://github.com/nvim-lua/plenary.nvim) (optional) if using `resession` backend. |
10 | 11 |
|
11 | 12 | ## Commands |
12 | 13 |
|
@@ -34,6 +35,7 @@ To configure the plugin, you can call `require('session_manager').setup(values)` |
34 | 35 | local Path = require('plenary.path') |
35 | 36 | local config = require('session_manager.config') |
36 | 37 | require('session_manager').setup({ |
| 38 | + resession_backend = false, -- Use resession.nvim as backend instead of vim's built-in :mksession |
37 | 39 | sessions_dir = Path:new(vim.fn.stdpath('data'), 'sessions'), -- The directory where the session files will be saved. |
38 | 40 | session_filename_to_dir = session_filename_to_dir, -- Function that replaces symbols into separators and colons to transform filename into a session directory. |
39 | 41 | dir_to_session_filename = dir_to_session_filename, -- Function that replaces separators and colons into special symbols to transform session directory into a filename. Should use `vim.uv.cwd()` if the passed `dir` is `nil`. |
@@ -116,6 +118,33 @@ vim.api.nvim_create_autocmd({ 'BufWritePre' }, { |
116 | 118 | }) |
117 | 119 | ``` |
118 | 120 |
|
| 121 | +## Resession backend |
| 122 | + |
| 123 | +If you want to use `resession.nvim` as a backend instead of the built-in `:mksession`, set `resession_backend` to `true` in the configuration. Make sure you have `resession.nvim` installed. |
| 124 | + |
| 125 | +Session-manager Config |
| 126 | +```lua |
| 127 | +{ |
| 128 | + "Shatur/neovim-session-manager", |
| 129 | + lazy = false, |
| 130 | + dependencies = { |
| 131 | + { |
| 132 | + "stevearc/resession.nvim", |
| 133 | + lazy = false, |
| 134 | + config = true, |
| 135 | + }, |
| 136 | + }, |
| 137 | + config = function() |
| 138 | + require("session_manager").setup({ |
| 139 | + -- ... |
| 140 | + }) |
| 141 | + end, |
| 142 | +}, |
| 143 | +``` |
| 144 | +for session saving config, sen [resession-session-options](https://github.com/stevearc/resession.nvim#setup-options) |
| 145 | + |
| 146 | +## Additional resources |
| 147 | + |
119 | 148 | For more information about autocmd and its event, see also: |
120 | 149 |
|
121 | 150 | - [`:help autocmd`](https://neovim.io/doc/user/autocmd.html) |
|
0 commit comments