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
Copy file name to clipboardExpand all lines: README.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,8 @@ Here are the default settings:
64
64
suppressed_dirs=nil, -- Suppress session restore/create in certain directories
65
65
allowed_dirs=nil, -- Allow session restore/create in certain directories
66
66
auto_restore_last_session=false, -- On startup, loads the last saved session if session for cwd does not exist
67
-
use_git_branch=false, -- Include git branch name in session name
67
+
git_use_branch_name=false, -- Include git branch name in session name
68
+
git_auto_restore_on_branch_change=false, -- Should we auto-restore the session when the git branch changes. Requires git_use_branch_name
68
69
lazy_support=true, -- Automatically detect if Lazy.nvim is being used and wait until Lazy is done to make sure session is restored correctly. Does nothing if Lazy isn't being used. Can be disabled if a problem is suspected or for debugging
69
70
bypass_save_filetypes=nil, -- List of filetypes to bypass auto save when the only buffer open is one of the file types listed, useful to ignore dashboards
70
71
close_unsupported_windows=true, -- Close windows that aren't backed by normal file before autosaving a session
Copy file name to clipboardExpand all lines: doc/auto-session.txt
+39-38
Original file line number
Diff line number
Diff line change
@@ -11,44 +11,45 @@ Config *auto-session.config*
11
11
AutoSession.Config *AutoSession.Config*
12
12
13
13
Fields: ~
14
-
{enabled?} (boolean) Enables/disables auto saving and restoring
15
-
{root_dir?} (string) root directory for session files, by default is `vim.fn.stdpath('data') .. '/sessions/'`
16
-
{auto_save?} (boolean) Enables/disables auto saving session on exit
17
-
{auto_restore?} (boolean) Enables/disables auto restoring session on start
18
-
{auto_create?} (boolean|function) Enables/disables auto creating new session files. Can take a function that should return true/false if a new session file should be created or not
19
-
{auto_delete_empty_sessions?} (boolean) Enables/disables deleting the session if there no named, non-empty buffers when auto-saving
20
-
{suppressed_dirs?} (table) Suppress auto session for directories
21
-
{allowed_dirs?} (table) Allow auto session for directories, if empty then all directories are allowed except for suppressed ones
22
-
{auto_restore_last_session?} (boolean) On startup, loads the last saved session if session for cwd does not exist
23
-
{use_git_branch?} (boolean) Include git branch name in session name to differentiate between sessions for different git branches
24
-
{lazy_support?} (boolean) Automatically detect if Lazy.nvim is being used and wait until Lazy is done to make sure session is restored correctly. Does nothing if Lazy isn't being used. Can be disabled if a problem is suspected or for debugging
25
-
{bypass_save_filetypes?} (table) List of file types to bypass auto save when the only buffer open is one of the file types listed, useful to ignore dashboards
26
-
{close_unsupported_windows?} (boolean) Whether to close windows that aren't backed by a real file
27
-
{args_allow_single_directory?} (boolean) Follow normal sesion save/load logic if launched with a single directory as the only argument
28
-
Argv Handling
29
-
{args_allow_files_auto_save?} (boolean|function) Allow saving a session even when launched with a file argument (or multiple files/dirs). It does not load any existing session first. While you can just set this to true, you probably want to set it to a function that decides when to save a session when launched with file args. See documentation for more detail
30
-
{continue_restore_on_error?} (boolean) Keep loading the session even if there's an error. Set to false to get the line number of an error when loading a session
31
-
{show_auto_restore_notif?} (boolean) Whether to show a notification when auto-restoring
{cwd_change_handling?} (boolean) Follow cwd changes, saving a session before change and restoring after
34
-
{lsp_stop_on_restore?} (boolean|function) Should language servers be stopped when restoring a session. Can also be a function that will be called if set. Not called on autorestore from startup
35
-
{restore_error_handler?} (restore_error_fn) Called when there's an error restoring. By default, it ignores fold errors otherwise it displays the error and returns false to disable auto_save
36
-
37
-
{purge_after_minutes?} (number|nil) -- Sessions older than purge_after_minutes will be deleted asynchronously on startup, e.g. set to 14400 to delete sessions that haven't been accessed for more than 10 days, defaults to off (no purging), requires >= nvim 0.10
{pre_save_cmds?} (table) executes before a session is saved
41
-
42
-
Hooks
43
-
{save_extra_cmds?} (table) executes before a session is saved
44
-
{post_save_cmds?} (table) executes after a session is saved
45
-
{pre_restore_cmds?} (table) executes before a session is restored
46
-
{post_restore_cmds?} (table) executes after a session is restored
47
-
{pre_delete_cmds?} (table) executes before a session is deleted
48
-
{post_delete_cmds?} (table) executes after a session is deleted
49
-
{no_restore_cmds?} (table) executes at VimEnter when no session is restored
50
-
{pre_cwd_changed_cmds?} (table) executes before cwd is changed if cwd_change_handling is true
51
-
{post_cwd_changed_cmds?} (table) executes after cwd is changed if cwd_change_handling is true
14
+
{enabled?} (boolean) Enables/disables auto saving and restoring
15
+
{root_dir?} (string) root directory for session files, by default is `vim.fn.stdpath('data') .. '/sessions/'`
16
+
{auto_save?} (boolean) Enables/disables auto saving session on exit
17
+
{auto_restore?} (boolean) Enables/disables auto restoring session on start
18
+
{auto_create?} (boolean|function) Enables/disables auto creating new session files. Can take a function that should return true/false if a new session file should be created or not
19
+
{auto_delete_empty_sessions?} (boolean) Enables/disables deleting the session if there no named, non-empty buffers when auto-saving
20
+
{suppressed_dirs?} (table) Suppress auto session for directories
21
+
{allowed_dirs?} (table) Allow auto session for directories, if empty then all directories are allowed except for suppressed ones
22
+
{auto_restore_last_session?} (boolean) On startup, loads the last saved session if session for cwd does not exist
23
+
{git_use_branch_name?} (boolean) Include git branch name in session name to differentiate between sessions for different git branches
24
+
{git_auto_restore_on_branch_change?} (boolean) Should we auto-restore the session when the git branch changes. Requires git_use_branch_name
25
+
{lazy_support?} (boolean) Automatically detect if Lazy.nvim is being used and wait until Lazy is done to make sure session is restored correctly. Does nothing if Lazy isn't being used. Can be disabled if a problem is suspected or for debugging
26
+
{bypass_save_filetypes?} (table) List of file types to bypass auto save when the only buffer open is one of the file types listed, useful to ignore dashboards
27
+
{close_unsupported_windows?} (boolean) Whether to close windows that aren't backed by a real file
28
+
{args_allow_single_directory?} (boolean) Follow normal sesion save/load logic if launched with a single directory as the only argument
29
+
Argv Handling
30
+
{args_allow_files_auto_save?} (boolean|function) Allow saving a session even when launched with a file argument (or multiple files/dirs). It does not load any existing session first. While you can just set this to true, you probably want to set it to a function that decides when to save a session when launched with file args. See documentation for more detail
31
+
{continue_restore_on_error?} (boolean) Keep loading the session even if there's an error. Set to false to get the line number of an error when loading a session
32
+
{show_auto_restore_notif?} (boolean) Whether to show a notification when auto-restoring
{cwd_change_handling?} (boolean) Follow cwd changes, saving a session before change and restoring after
35
+
{lsp_stop_on_restore?} (boolean|function) Should language servers be stopped when restoring a session. Can also be a function that will be called if set. Not called on autorestore from startup
36
+
{restore_error_handler?} (restore_error_fn) Called when there's an error restoring. By default, it ignores fold errors otherwise it displays the error and returns false to disable auto_save
37
+
38
+
{purge_after_minutes?} (number|nil) -- Sessions older than purge_after_minutes will be deleted asynchronously on startup, e.g. set to 14400 to delete sessions that haven't been accessed for more than 10 days, defaults to off (no purging), requires >= nvim 0.10
Copy file name to clipboardExpand all lines: lua/auto-session/config.lua
+11-4
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,8 @@ local M = {}
16
16
---@fieldsuppressed_dirs? table Suppress auto session for directories
17
17
---@fieldallowed_dirs? table Allow auto session for directories, if empty then all directories are allowed except for suppressed ones
18
18
---@fieldauto_restore_last_session? boolean On startup, loads the last saved session if session for cwd does not exist
19
-
---@fielduse_git_branch? boolean Include git branch name in session name to differentiate between sessions for different git branches
19
+
---@fieldgit_use_branch_name? boolean Include git branch name in session name to differentiate between sessions for different git branches
20
+
---@fieldgit_auto_restore_on_branch_change? boolean Should we auto-restore the session when the git branch changes. Requires git_use_branch_name
20
21
---@fieldlazy_support? boolean Automatically detect if Lazy.nvim is being used and wait until Lazy is done to make sure session is restored correctly. Does nothing if Lazy isn't being used. Can be disabled if a problem is suspected or for debugging
21
22
---@fieldbypass_save_filetypes? table List of file types to bypass auto save when the only buffer open is one of the file types listed, useful to ignore dashboards
22
23
---@fieldclose_unsupported_windows? boolean Whether to close windows that aren't backed by a real file
@@ -79,7 +80,8 @@ local defaults = {
79
80
suppressed_dirs=nil, -- Suppress session restore/create in certain directories
80
81
allowed_dirs=nil, -- Allow session restore/create in certain directories
81
82
auto_restore_last_session=false, -- On startup, loads the last saved session if session for cwd does not exist
82
-
use_git_branch=false, -- Include git branch name in session name
83
+
git_use_branch_name=false, -- Include git branch name in session name
84
+
git_auto_restore_on_branch_change=false, -- Should we auto-restore the session when the git branch changes. Requires git_use_branch_name
83
85
lazy_support=true, -- Automatically detect if Lazy.nvim is being used and wait until Lazy is done to make sure session is restored correctly. Does nothing if Lazy isn't being used. Can be disabled if a problem is suspected or for debugging
84
86
bypass_save_filetypes=nil, -- List of filetypes to bypass auto save when the only buffer open is one of the file types listed, useful to ignore dashboards
85
87
close_unsupported_windows=true, -- Close windows that aren't backed by normal file before autosaving a session
@@ -142,7 +144,7 @@ local function check_for_vim_globals(config)
0 commit comments