Vim session management system with a focus on git branches.
Executing :SaveSession
will save a session associated with the current branch checked out within the repo.
Executing OpenSession
will open the session you saved that is associated with the current branch name.
If you switch branch you can save/open a different session associated with the branch you just switched to without affecting other branch sessions.
Markdown files for taking notes associated with the branch can be managed using :SaveNote
and :OpenNote
Saving and opening sessions will work and automatically name the session file main.vim
in case the directory is ever initialised as a git repo.
-
:SaveSession
-- To create a session -
:OpenSession
-- Open a session -
:CleanupSessions
-- Remove sessions that do not have a local branch (only works within git repositories) -
:SaveNote
-- Save notes related to the session -
:OpenNote
-- Open note associated with the session -
:GrepNotes *
-- Search all notes for given arg -
:GrepTicketNotesFzf
-- FZF grep notes (requires FZF
To automatically open and save session files when opening/closing vim set the following in your .vimrc
:
let g:auto_ticket = 1
Black list some branches from being used with the auto feature:
let g:auto_ticket = 1
let g:ticket_black_list = ['master', 'other-branch']
Define a default branch name that will used to name all non git repo session files (default: main):
let g:default_session_name = 'master'
Define the directory you want to store all session files within:
let g:session_directory = '~/my_dir'
With Vim-Plug:
Plug 'superDross/ticket.vim'
With Packer.nvim:
require('packer').startup(function(use)
use 'superDross/ticket.vim'
end)
The session files are stored as below; git repository directory name with all branch specific session and note files within it.
~/.local/share/tickets-vim/
│
└── <repository-name>/
├── <branch-name>.md
└── <branch-name>.vim
The legacy root directory is ~/.tickets
, however, if this is not currently being used (or it has not been set via g:session_directory
) then the XDG base directory spec will be followed.
This will check and prioritise the directory set in $XDG_CONFIG_DATA
, if not set then ~/.local/share
will be used.
-
The organisation and storage of the branch based session files depends upon the repo & git branch pairing name being unique.
-
Only works within *NIX based systems.
-
This plugin assumes it has the appropriate permissions for modifying files locally