Skip to main content

A small python program for managing vim sessions

Project description

Vim Session Manager

A manager for the under-utilized `mksession` command in vim

GitHub issues GitHub GitHub contributors GitHub forks GitHub Repo stars Lines of code

: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

  • Open session by name (regex filtered)
  • Remove session by name (regex filtered)
  • List all sessions
  • Open sessions from an interactive prompt
  • Batch session file removal from an interactive prompt
  • Manages different vim variations (vim, nvim, gvim, macvim etc..)
  • Show programmer statistics for each session when listed

Current planned packaging

  • Pip install from this repo
  • Build and install manually with poetry
  • Pip install from pypi

Installing

  1. Pip Installing from git
# Copy and run this command
pip install git+https://github.com/mattcoding4days/vsm.git#egg=vim_session_manager --user

# you should now be able to use the program
vsm --help
  1. Pip install from Pypi (Not available)

pip install vim_session_manager

: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.

  • bash/zsh export VIM_SESSIONS="path/to/where/you/want/to/store/your/sessions"

  • fish set -Ux VIM_SESSIONS "path/to/where/you/want/to/store/your/sessions"

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

  1. result for Rust like elegance

  2. inquirer for fancy prompt driven selection

  3. rich, make terminal programs great again

:scroll: Documentation

To be completed

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vim_session_manager-0.1.2.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vim_session_manager-0.1.2-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file vim_session_manager-0.1.2.tar.gz.

File metadata

  • Download URL: vim_session_manager-0.1.2.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.15.0-40-generic

File hashes

Hashes for vim_session_manager-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b47dece146e7ab92f823a7d79d182ebe6047f30a035f97765ed259f247356c3d
MD5 5f597f696f539d4ef3e82d29f03e832c
BLAKE2b-256 2782929837bc61bcf352ad843850c6c6c327cffdef903fae4d3450cdd3e56af4

See more details on using hashes here.

File details

Details for the file vim_session_manager-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: vim_session_manager-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.15.0-40-generic

File hashes

Hashes for vim_session_manager-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 16d9c399f960f42c9c8eac38751dee8bec31dd13e00267a5caff0a79d4121b90
MD5 1fbc2665eee073b5f5f1237bcd1b9975
BLAKE2b-256 2f06fa3315c325e1b8f9ba9ccbebd8774cc438a1352fd5b86fb54713c13a79da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page