The Vim plugin EasySession offers a convenient and effortless way to persist and restore Vim editing sessions. It can significantly increase productivity and save a lot of time for users who frequently switch between different projects and those who frequently open and close the Vim editor.
In addition to its automatic session management capabilities, the EasySession Vim plugin also offers a variety of useful Vim commands that allow users to save, load, list and delete sessions manually.
Copyright (C) 2022-2024 James Cherti.
Distributed under terms of the MIT license.
- Automatically save and restore the Vim editing session (It can be activated by setting
g:easysession_auto_load
andg:easysession_auto_save
to 1), - Automatically save the current editing session when Vim is closed or when a file is saved (a few additional options are added to the session file that is generated by
mksession
: the font&guifont
, the&background
, and the color scheme). - Manually save the current Vim editing session:
:EasySessionSave
, - Switch to a different session:
:EasySessionLoad SESSION_NAME
, - List the available sessions:
:EasySessionList
, - Delete the current Vim session:
:EasySessionDelete SESSION_NAME
, - Rename the current Vim session:
:EasySessionRename SESSION_NAME
, - Auto-complete the Vim commands (e.g.
:EasySessionLoad
,:EasySessionDelete
...), - Specify the directory where all the saved sessions are located with:
let g:easysession_dir = expand('~/.my_vim_sessions')
.
For more information about the commands and options:
:help easysession
Add to ~/.vimrc
:
let g:easysession_auto_load = 1
let g:easysession_auto_save = 1
let g:easysession_save_guifont = 1
let g:easysession_save_colorscheme = 1
" Configure session options in Vim to include blank windows,current
" directory, folds, help windows, tab pages, Unix line endings, and use
" slashes for paths. You can also add to it: buffers,options,localoptions...
" Check `:help sessionoptions`.
set sessionoptions=blank,curdir,folds,help,tabpages,unix,slash,winsize
Please star vim-easysession on GitHub.
You can also follow the author on Github @jamescherti and Twitter @jamescherti.
mkdir -p ~/.vim/pack/jamescherti/start
cd ~/.vim/pack/jamescherti/start
git clone --depth 1 https://github.com/jamescherti/vim-easysession
vim -u NONE -c "helptags vim-easysession/doc" -c q
You can also install this Vim plugin with any third-party plugin manager such as Pathogen or Vundle.