From 4961a383b7e56debc320e30f4fb8b1f3f369aed8 Mon Sep 17 00:00:00 2001 From: Cameron Ring Date: Fri, 23 Aug 2024 14:02:13 -0700 Subject: [PATCH] docs: Add allowed/suppressed dirs to readme Fixes #350 Also update `continue_restore_on_error` description --- README.md | 17 +++++++++++++++-- lua/auto-session/config.lua | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d3dfd6c..3e1f9a4 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Here are the default settings: close_unsupported_windows = true, -- Close windows that aren't backed by normal file before autosaving a session args_allow_single_directory = true, -- Follow normal sesion save/load logic if launched with a single directory as the only argument args_allow_files_auto_save = false, -- 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 - continue_restore_on_error = true, -- 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 + continue_restore_on_error = true, -- Keep loading the session even if there's an error cwd_change_handling = false, -- Follow cwd changes, saving a session before change and restoring after log_level = "error", -- Sets the log level of the plugin (debug, info, warn, error). @@ -203,7 +203,20 @@ NOTE: If you previously installed `rmagatti/session-lens`, you should remove it -## 📁 Current Working Directory +## 📁 Allowed / Suppressed directories + +There are two config options, `allowed_dirs` and `suppressed_dirs`, that control which directories AutoSession will auto-save a session for. If `allowed_dirs` is set, sessions will only be auto-saved in matching directories. If `suppressed_dirs` is set, then a session won't be auto-saved for a matching directory. If both are set, a session will only be auto-saved if it matches an allowed dir and does not match a suppressed dir. + +Both options are a table of directories, with support for globs: + +```lua + alloweded_dirs = { '/some/dir/', '/projects/*' } + suppressed_dirs = { '/projects/secret' } +``` + +With those options, sessions would only be auto-saved for `/some/dir` and any direct child of `/projects` (e.g. `/projects/myproject` but not `/projects/myproject/submodule`) except `/projects/secret` + +## 🚶 Current Working Directory AutoSession can track `cwd` changes! diff --git a/lua/auto-session/config.lua b/lua/auto-session/config.lua index dfe3900..ddc5891 100644 --- a/lua/auto-session/config.lua +++ b/lua/auto-session/config.lua @@ -70,7 +70,7 @@ local defaults = { close_unsupported_windows = true, -- Close windows that aren't backed by normal file before autosaving a session args_allow_single_directory = true, -- Follow normal sesion save/load logic if launched with a single directory as the only argument args_allow_files_auto_save = false, -- 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 - continue_restore_on_error = true, -- 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 + continue_restore_on_error = true, -- Keep loading the session even if there's an error cwd_change_handling = false, -- Follow cwd changes, saving a session before change and restoring after log_level = "error", -- Sets the log level of the plugin (debug, info, warn, error).