|0.1.1||Nov 11, 2022|
|0.1.0||Nov 10, 2022|
#1050 in Command line utilities
Vim Session Manager
A BLAZINGLY FAST, simple, interactive command line session manager
Table of Contents
If you use vim or neovim on a daily basis and work in large codebases, it is probably not uncommon for you to have 10+ tabs open at a time,
with various splits. Once you close this vim session the layout is lost to the ethers. the
mksession command in vim(neovim) can save you,
thus saving the session to a directory, promising to return you to your work exactly how you left it.
However, the problem is most of us accrue many of these session files scattered about, personally I have
41 vim session files,
easily loading them, rememembering the context of each one, and removing stale sessions becomes a hassle. enter vsm (Vim Session Manager),
it allows you to list, open, and remove sessions files, either interactively or by name. It also manages different variations of vim, and allows
you to switch between them. For example you may be a
neovide user rather than
neovim, vsm currently supports
vim, neovim, neovide and gvim.
Currently I have only found one other project which allows more indepth session file management.
However it didn't suit my desires, as it is written in vim script, suffers from useless feature rot, and relies heavily on the xolox misc plugin,
together loading in over
1200 or so lines of vim script just to manage some session files, it also seems to be unmaintained as the
last change recorded was July 6, 2014. Because of this I wrote
vsm, it seemed like a better solution to make an external cli program and off load
work from vim and shorten my plugin list as much as possible.
Install with cargo
cargo install vsm
Building from source
Installs the optimized binary to
git clone https://gitlab.com/thebashpotato/vsm cargo install just just install
An environement variable
VIM_SESSIONSis expected on the system, if it is not defined
vsmwill default to
~/.config/vim_sessionswhen it looks for your session files. Below are 2 examples for settings the variable in different shells. You can set the path where ever you want.
set -Ux VIM_SESSIONS "$HOME/.config/vim_sessions"
Create session files easier (in vim)
vsmcan load, list and remove session files, but it can't create them. That is the job of
Add the below snippet to your
init.vimto make creating new session files much easier. Now in
normal modeyou can press
mkto quickly save your session file.
if isdirectory(expand($VIM_SESSIONS)) " Create a new sesion file (must give the file a unique name nnoremap mk :mksession $VIM_SESSIONS/ " Overwrite an existing sessioon file with your current layout nnoremap mo :mksession! $VIM_SESSIONS/ else nnoremap mk :echo "VIM_SESSIONS directory does not exist"<CR> nnoremap mo :echo "VIM_SESSIONS directory does not exist"<CR> endif
just to bootstrap all tools and configuration.
cargo install just just init # setup repo, install hooks and all required tools
Before committing your work:
To see all available commands:
Small note: If editing the README, please conform to the standard-readme specification.
This project is licensed under: