Customize Session Management
Since AstroNvim v4, we have begun using resession.nvim for powering session management. This plugins provides an extensive Lua API for building out the features we want when saving and restoring sessions. This allows us to handle things such as our tab-local buffer management. This is a very powerful Lua API but can take some learning to configure the way you want. This page provides a few common recipes that userβs want that can be easily added to your user configuration.
AstroNvim Defaults
To ease the use of resession we have built a few features into AstroNvim which can be configured. By default AstroNvim is set up to save the previous session as well as the last session for each working directory on exit and has the ability to configure buffers which the user wants to ignore when saving sessions. These options are configured through the AstroNvim/astrocore
plugin and has the following defaults:
Automatically Restore Previous Session
Some users may want to automatically restore their previous session for a given directory when opening Neovim with no arguments. This can be achieved by setting up an auto command on the VimEnter
event:
Git Branch Specific Directory Sessions
Some users may want to save sessions not only specific to their directory, but also the current branch checked out in git
if applicable. This can also be easily configurable.