You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. When starting `nvim` with no arguments, auto-session will try to restore an existing session for the current `cwd` if one exists.
10
-
2. When starting `nvim .` (or another directory), auto-session will try to restore the session for that directory.
11
-
3. When starting `nvim some_file.txt` (or multiple files), by default, auto-session won't do anything. See [argument handling](#argument-handling) for more details.
11
+
1. When starting `nvim` with no arguments, AutoSession will try to restore an existing session for the current `cwd` if one exists.
12
+
2. When starting `nvim .` (or another directory), AutoSession will try to restore the session for that directory.
13
+
3. When starting `nvim some_file.txt` (or multiple files), by default, AutoSession won't do anything. See [argument handling](#argument-handling) for more details.
12
14
4. Even after starting `nvim` with a file argument, a session can still be manually restored by running `:SessionRestore`.
13
15
5. Any session saving and restoration takes into consideration the current working directory `cwd`.
14
-
6. When piping to `nvim`, e.g: `cat myfile | nvim`, auto-session won't do anything.
16
+
6. When piping to `nvim`, e.g: `cat myfile | nvim`, AutoSession won't do anything.
15
17
16
18
:warning: Please note that if there are errors in your config, restoring the session might fail, if that happens, auto session will then disable auto saving for the current session.
17
19
Manually saving a session can still be done by calling `:SessionSave`.
@@ -20,16 +22,16 @@ AutoSession can now track `cwd` changes!
20
22
By default, `cwd` handling is disabled but when enabled, it works as follows:
21
23
22
24
- DirChangedPre (before the cwd actually changes):
23
-
- Save the current session
24
-
- Clear all buffers `%bd!`. This guarantees buffers don't bleed to the
25
-
next session.
26
-
- Clear jumps. Also done so there is no bleeding between sessions.
27
-
- Run the `pre_cwd_changed_hook`/
25
+
- Save the current session
26
+
- Clear all buffers `%bd!`. This guarantees buffers don't bleed to the
27
+
next session.
28
+
- Clear jumps. Also done so there is no bleeding between sessions.
29
+
- Run the `pre_cwd_changed_hook`/
28
30
- DirChanged (after the cwd has changed):
29
-
- Restore session using new cwd
30
-
- Run the `post_cwd_changed_hook`
31
+
- Restore session using new cwd
32
+
- Run the `post_cwd_changed_hook`
31
33
32
-
Now when the user changes the cwd with `:cd some/new/dir`auto-session handles it gracefully, saving the current session so there aren't losses and loading the session for the upcoming cwd if it exists.
34
+
Now when the user changes the cwd with `:cd some/new/dir`AutoSession handles it gracefully, saving the current session so there aren't losses and loading the session for the upcoming cwd if it exists.
33
35
34
36
Hooks are available for custom actions _before_ and _after_ the `cwd` is changed. These hooks can be configured through the `cwd_change_handling` key as follows:
35
37
@@ -85,7 +87,7 @@ use {
85
87
86
88
### Default
87
89
88
-
Auto Session by default stores sessions in `vim.fn.stdpath('data').."/sessions/"`.
90
+
AutoSession by default stores sessions in `vim.fn.stdpath('data').."/sessions/"`.
89
91
90
92
### Custom
91
93
@@ -194,7 +196,7 @@ Now last session will be restored only when Neovim is launched in the home direc
194
196
195
197
# 📢 Commands
196
198
197
-
Auto Session exposes two commands that can be used or mapped to any keybindings for manually saving and restoring sessions.
199
+
AutoSession exposes the following commands that can be used or mapped to any keybindings for manually saving and restoring sessions.
198
200
199
201
```viml
200
202
:SessionSave " saves or creates a session in the currently set `auto_session_root_dir`.
@@ -205,8 +207,8 @@ Auto Session exposes two commands that can be used or mapped to any keybindings
205
207
:SessionDelete " deletes a session in the currently set `auto_session_root_dir`.
206
208
:SessionDelete ~/my/custom/path " deletes a session based on the provided path.
207
209
:SessionPurgeOrphaned " removes all orphaned sessions with no working directory left.
208
-
:Autosession search
209
-
:Autosession delete
210
+
:Autosession search " open a vim.ui.select picker to choose a session to load.
211
+
:Autosession delete " open a vim.ui.select picker to choose a session to delete.
210
212
```
211
213
212
214
You can use the `Autosession {delete|search}` command to open a picker using `vim.ui.select` this will allow you to either delete or search for a session to restore.
@@ -218,14 +220,14 @@ There's also Telescope support, see the [Session Lens](#-session-lens) section b
218
220
219
221
Command hooks exist in the format: {hook_name}
220
222
221
-
- {pre_save}: executes _before_ a session is saved
222
-
- {save_extra}: executes _after_ a session is saved, return string will save to `*x.vim`, reference `:help mks`
223
-
- {post_save}: executes _after_ a session is saved
224
-
- {pre_restore}: executes _before_ a session is restored
225
-
- {post_restore}: executes _after_ a session is restored
226
-
- {pre_delete}: executes _before_ a session is deleted
227
-
- {post_delete}: executes _after_ a session is deleted
228
-
- {no_restore}: executes _at_`VimEnter`_when_ no session is restored
223
+
-`{pre_save}`: executes _before_ a session is saved
224
+
-`{save_extra}`: executes _after_ a session is saved, return string will save to `*x.vim`, reference `:help mks`
225
+
-`{post_save}`: executes _after_ a session is saved
226
+
-`{pre_restore}`: executes _before_ a session is restored
227
+
-`{post_restore}`: executes _after_ a session is restored
228
+
-`{pre_delete}`: executes _before_ a session is deleted
229
+
-`{post_delete}`: executes _after_ a session is deleted
230
+
-`{no_restore}`: executes _at_`VimEnter`_when_ no session is restored
229
231
230
232
Hooks are configured by setting
231
233
@@ -290,7 +292,7 @@ use this to only create sessions for git projects:
290
292
291
293
## Argument Handling
292
294
293
-
By default, when `nvim` is run with a single directory argument, auto-session will try to restore the session for that directory. If `nvim` is run with multiple directories or any file arguments, auto-session won't try to restore a session and won't auto-save a session on exit (if enabled). Those behaviors can be changed with these config parameters:
295
+
By default, when `nvim` is run with a single directory argument, AutoSession will try to restore the session for that directory. If `nvim` is run with multiple directories or any file arguments, AutoSession won't try to restore a session and won't auto-save a session on exit (if enabled). Those behaviors can be changed with these config parameters:
294
296
295
297
```lua
296
298
args_allow_single_directory=true, -- boolean Follow normal sesion save/load logic if launched with a single directory as the only argument
@@ -303,7 +305,7 @@ For `args_allow_single_directory`, if you frequently use `netrw` to look at dire
303
305
bypass_session_save_file_types= { 'netrw' }
304
306
```
305
307
306
-
If `args_allow_files_auto_save` is true, auto-session won't load any session when `nvim` is launched with file argument(s) but it will save on exit. What's probably more useful is to set `args_allow_files_auto_save` to a function that returns true if a session should be saved and false otherwise. auto-session will call that function on auto save when run with arguments. Here's one example config where it will save the session if at least two buffers are open after being launched with arguments:
308
+
If `args_allow_files_auto_save` is true, AutoSession won't load any session when `nvim` is launched with file argument(s) but it will save on exit. What's probably more useful is to set `args_allow_files_auto_save` to a function that returns true if a session should be saved and false otherwise. AutoSession will call that function on auto save when run with arguments. Here's one example config where it will save the session if at least two buffers are open after being launched with arguments:
307
309
308
310
```lua
309
311
return {
@@ -379,7 +381,7 @@ For troubleshooting refer to the [wiki page](https://github.com/rmagatti/auto-se
379
381
380
382
## 🔭 Session Lens
381
383
382
-
Session Lens has been merged into Auto Session so now you can see, load, and delete your sessions using Telescope! It's enabled by
384
+
Session Lens has been merged into AutoSession so now you can see, load, and delete your sessions using Telescope! It's enabled by
383
385
default if you have Telescope, but here's the Lazy config that shows the configuration options:
You can also use `:Telescope session-lens` to launch the session picker.
420
422
421
423
The following shortcuts are available when the session-lens picker is open
422
-
*`<c-s>` restores the previously opened session. This can give you a nice flow if you're constantly switching between two projects.
423
-
*`<c-d>` will delete the currently highlighted session. This makes it easy to keep the session list clean.
424
+
425
+
-`<c-s>` restores the previously opened session. This can give you a nice flow if you're constantly switching between two projects.
426
+
-`<c-d>` will delete the currently highlighted session. This makes it easy to keep the session list clean.
424
427
425
428
NOTE: If you previously installed `rmagatti/session-lens`, you should remove it from your config as it is no longer necessary.
426
429
427
-
Auto Session provides its own `:Autosession search` and `:Autosession delete` commands, but session-lens is a more complete version of those commands that is specifically built to be used with `telescope.nvim`. These commands make use of `vim.ui.select` which can itself be implemented by other plugins other than telescope.
430
+
AutoSession provides its own `:Autosession search` and `:Autosession delete` commands, but session-lens is a more complete version of those commands that is specifically built to be used with `telescope.nvim`. These commands make use of `vim.ui.select` which can itself be implemented by other plugins other than telescope.
0 commit comments