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
+17-1
Original file line number
Diff line number
Diff line change
@@ -103,7 +103,7 @@ EOF
103
103
104
104
```lua
105
105
require("auto-session").setup {
106
-
bypass_session_save_file_types=nil, -- table: Bypass auto save when only buffer open is one of these file types
106
+
bypass_session_save_file_types=nil, -- table: Bypass auto save when only buffer open is one of these file types, useful to ignore dashboards
107
107
close_unsupported_windows=true, -- boolean: Close windows that aren't backed by normal file
108
108
cwd_change_handling= { -- table: Config for handling the DirChangePre and DirChanged autocmds, can be set to nil to disable altogether
109
109
restore_upcoming_session=false, -- boolean: restore session for upcoming cwd on cwd change
@@ -391,6 +391,11 @@ You can use Telescope to see, load, and delete your sessions. It's enabled by de
391
391
load_on_setup=true,
392
392
theme_conf= { border=true },
393
393
previewer=false,
394
+
mappings= {
395
+
-- Mode can be a string or a table, e.g. {"i", "n"} for both insert and normal mode
396
+
delete_session= { "i", "<C-D>" },
397
+
alternate_session= { "i", "<C-S>" },
398
+
},
394
399
},
395
400
})
396
401
end,
@@ -434,6 +439,17 @@ require('lualine').setup{
434
439
435
440
<imgwidth="1904"alt="Screen Shot 2021-10-30 at 3 58 57 PM"src="https://user-images.githubusercontent.com/2881382/139559478-8edefdb8-8254-42e7-a0f3-babd3dfd6ff2.png">
436
441
442
+
## Dashboards
443
+
444
+
If you use a dashboard, you probably don't want to try and save a session when just the dashboard is open. To avoid that, add your dashboard filetype to the bypass list as follows:
445
+
446
+
```lua
447
+
require('auto-session').setup({
448
+
bypass_session_save_file_types= { 'alpha', 'dashboard' } -- or whatever dashboard you use
449
+
})
450
+
451
+
```
452
+
437
453
## Disabling the plugin
438
454
439
455
You might run into issues with Firenvim or another plugin and want to disable `auto_session` altogether based on some condition.
{bypass_session_save_file_types?} (table) List of file types to bypass auto save when the only buffer open is one of the file types listed
23
+
{bypass_session_save_file_types?} (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
24
24
{close_unsupported_windows?} (boolean) Whether to close windows that aren't backed by a real file
25
25
{silent_restore?} (boolean) Suppress extraneous messages and source the whole session, even if there's an error. Set to false to get the line number of a restore error
---@fieldbypass_session_save_file_types? table List of file types to bypass auto save when the only buffer open is one of the file types listed
75
+
---@fieldbypass_session_save_file_types? 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
76
76
---@fieldclose_unsupported_windows? boolean Whether to close windows that aren't backed by a real file
77
77
---@fieldsilent_restore? boolean Suppress extraneous messages and source the whole session, even if there's an error. Set to false to get the line number of a restore error
bypass_session_save_file_types=nil, -- Bypass auto save when only buffer open is one of these file types
85
+
bypass_session_save_file_types=nil, -- Bypass auto save when only buffer open is one of these file types, useful to ignore dashboards
86
86
close_unsupported_windows=true, -- Close windows that aren't backed by normal file
87
87
args_allow_single_directory=true, -- Allow single directory arguments by default
88
88
args_allow_files_auto_save=false, -- Don't save session for file args by default
@@ -100,19 +100,41 @@ local luaOnlyConf = {
100
100
--- post_cwd_changed_hook = nil, -- lua function hook. This is called after auto_session code runs for the `DirChanged` autocmd
101
101
--- }
102
102
cwd_change_handling=false,
103
+
104
+
---Session Lens Config
105
+
---@classsession_lens_config
106
+
---@fieldload_on_setup? boolean
107
+
---@fieldshorten_path? boolean Deprecated, pass { 'shorten' } to path_display
108
+
---@fieldpath_display? table An array that specifies how to handle paths. Read :h telescope.defaults.path_display
109
+
---@fieldtheme_conf? table
110
+
---@fieldbuftypes_to_ignore? table Deprecated, if you're using this please report your usage on github
111
+
---@fieldpreviewer? boolean
112
+
---@fieldsession_control? session_control
113
+
---@fieldmappings? session_lens_mapping
114
+
103
115
---Session Control Config
104
116
---@classsession_control
105
117
---@fieldcontrol_dirstring
106
118
---@fieldcontrol_filenamestring
107
119
120
+
---Session Lens Mapping
121
+
---@classsession_lens_mapping
122
+
---@fielddelete_sessiontable mode and key for deleting a session from the picker
123
+
---@fieldalternate_sessiontable mode and key for swapping to alertnate session from the picker
124
+
108
125
---@typesession_lens_config
109
126
session_lens= {
110
-
buftypes_to_ignore= {}, -- list of bufftypes to ignore when switching between sessions
111
127
load_on_setup=true,
128
+
buftypes_to_ignore= {},
112
129
session_control= {
113
130
control_dir=vim.fn.stdpath"data" .."/auto_session/", -- Auto session control dir, for control files, like alternating between two sessions with session-lens
114
131
control_filename="session_control.json", -- File name of the session control file
115
132
},
133
+
mappings= {
134
+
-- Mode can be a string or a table, e.g. {"i", "n"} for both insert and normal mode
135
+
delete_session= { "i", "<C-D>" },
136
+
alternate_session= { "i", "<C-S>" },
137
+
},
116
138
},
117
139
silent_restore=true, -- Suppress extraneous messages and source the whole session, even if there's an error. Set to false to get the line number of a restore error
118
140
}
@@ -487,7 +509,7 @@ function AutoSession.session_exists_for_cwd()
ifSessionLens.conf.buftypes_to_ignore~=nilandnotvim.tbl_isempty(SessionLens.conf.buftypes_to_ignore) then
34
14
Lib.logger.warn"buftypes_to_ignore is deprecated. If you think you need this option, please file a bug on GitHub. If not, please remove it from your config"
0 commit comments