:information_source: Reasoning
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 28 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.
:superhero_man: Features
Current planned features
Current planned packaging
Installing
- Install from pypi
Check it out on Pypi
pip install vim-session-manager
- Pip Installing from the git repo
pip install git+https://github.com/mattcoding4days/vsm.git
:mage: Usage
Set up
NOTE that an environement variable VIM_SESSIONS
is expected on the system,
if it is not defined vsm
will default to ~/.config/vim_sessions
when it looks
for your session files.
Create session files easier
Add the below snippet to your .vimrc
or init.vim
to make creating
new session files much easier.
if isdirectory(expand($VIM_SESSIONS))
nnoremap mk :mksession $VIM_SESSIONS/
nnoremap mo :mksession! $VIM_SESSIONS/
else
nnoremap mk :echo "VIM_SESSIONS directory does not exist, get vim session manager at https://github.com/mattcoding4days/vsm"<CR>
nnoremap mo :echo "VIM_SESSIONS directory does not exist, get vim session manager at https://github.com/mattcoding4days/vsm"<CR>
endif
Exploring the help menu for subcommands
Managing many variations of vim installed on the system
Open a session file interactively
Open session file by name
Remove session file(s) interactively (one or many)
Note that only the arrow keys are supported for movement, and the space bar is used to select/unselect
Remove a single session file by name (with regex matching)
:construction_worker: Development
The project is managed by Python Poetry and uses python >= 3.10.1.
Note: mypy static analyzing currently will not work as it does not yet support the match statement
:keyboard: Commands to help you out
NOTE: if you are installing poetry, DO NOT install it with pip
curl -sSL https://install.python-poetry.org | python3 -
Install the package
poetry install
Run the tests to verify everything worked
pytest
Start a poetry shell and run the executable
poetry shell
vsm --help
:package: 3rd party libraries
Vim Session Manager uses the following Python libraries
-
result for Rust like elegance
-
inquirer for fancy prompt driven selection
-
rich, make terminal programs great again
:scroll: Documentation
To be completed