Crates.io | vsm |
lib.rs | vsm |
version | 0.1.1 |
source | src |
created_at | 2022-11-10 06:50:09.302712 |
updated_at | 2022-11-11 19:36:50.714548 |
description | A simple, interactive, command line vim session file manager. |
homepage | https://gitlab.com/thebashpotato/vsm |
repository | https://gitlab.com/thebashpotato/vsm |
max_upload_size | |
id | 709278 |
size | 367,561 |
A BLAZINGLY FAST, simple, interactive command line session manager
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.
cargo install vsm
Installs the optimized binary to
$HOME/.local/bin
git clone https://gitlab.com/thebashpotato/vsm
cargo install just
just install
An environement variable
VIM_SESSIONS
is expected on the system, if it is not definedvsm
will default to~/.config/vim_sessions
when 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.
bash/zsh export VIM_SESSIONS="$HOME/.config/vim_sessions"
fish set -Ux VIM_SESSIONS "$HOME/.config/vim_sessions"
vsm
can load, list and remove session files, but it can't create them. That is the job ofvim
.
Add the below snippet to your
.vimrc
orinit.vim
to make creating new session files much easier. Now innormal mode
you can pressmk
to 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
Only requires just
to bootstrap all tools and configuration.
cargo install just
just init # setup repo, install hooks and all required tools
To run:
just run
To test:
just test
Before committing your work:
just pre-commit
To see all available commands:
just list
PRs accepted.
Small note: If editing the README, please conform to the standard-readme specification.
This project is licensed under: