The EasySession Vim plugin 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.
Author and license
Copyright (C) 2022-2026 James Cherti.
Distributed under terms of the MIT license.
Features
- Automatically save and restore the Vim editing session (It can be activated by setting
g:easysession_auto_loadandg:easysession_auto_saveto 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
How to make EasySession automatically load and save the session?
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
Installation
Installation with Vim’s built-in package manager (Vim 8 and above)
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
Installation with a third-party plugin manager
You can also install this Vim plugin with any third-party plugin manager such as Pathogen or Vundle.
Related posts:
- Vim: Edit all the files in the current directory of a Git repository in new tabs (git ls-files)
- Vim: Enhance Vim tabs (file name only, file status, and the ability to rename tabs)
- Vim script: Replace the home directory with a tilde ~
- Master the HJKL navigation with the Vim plugin Hjklmode, which can help breaking the habit of moving the right hand away from the home row
- Vim theme: tomorrow-night-deepblue, a refreshing color scheme with a deep blue background
- outline-indent – Indentation based Folding and Outlining in Emacs
- A Vim function that returns all monospaced fonts (UNIX / Linux only)
- Vim: Tango color scheme for Vim’s built-in Terminal
- Vim: Open documentation in a new tab for the word under the cursor (Vim help, Python, man pages, Markdown, Ansible…)
- How to make Vim edit/diff files from outside of Vim? (e.g. from a shell like Bash, Zsh, Fish..)
- Vim: Quickly replace the word that is under the cursor
- Set up Vim to use Fasd for quickly jumping to directories
- Lightvim – The Efficient Minimal Vim/Neovim Configuration
- A Vim plugin for executing pathaction, the universal Makefile for the entire filesystem
- pathaction.el: An Emacs package for executing pathaction rules, the universal Makefile for the entire filesystem
- Configure XFCE 4 programmatically with the help of watch-xfce-xfconf
- Emacs: Open a Vertico/Consult or Ivy/Counsel candidate in a new tab
- Gentoo Linux: Printer driver for the Brother QL-1110NWB
- How Breaking Windows 30 Years Ago Turned Me Into a Software Developer and Linux Professional
- easysession.el – Easily persist and restore your Emacs editing sessions