Skip to content

tigion/nvim-sessions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nvim-sessions

A simple session management plugin for Neovim. It uses :mksession to save and :source to load working directory based sessions.

Warning

This plugin is based on my personal needs. Work in progress. 🚀

Other better plugins are:

Features

  • Uses one session file per working directory
  • Session files are stored global in vim.fn.stdpath('data') in a configurable subdirectory
  • Sessions are manually saved, loaded and deleted
  • It ignores empty windows from plugins like nvim-tree or outline
    (removes temporary blank from the :h sessionoptions)

Tip

See :h sessionoptions to change what is stored in the session file with :mksession.

Requirements

  • Neovim >= 0.10

Installation

return {
  'tigion/nvim-sessions',
  keys = {
    { '<Leader>ws', '<Cmd>Session save<CR>', desc = 'Save session (cwd)' },
    { '<Leader>wl', '<Cmd>Session load<CR>', desc = 'Load session (cwd)' },
  },
  opts = {},
}

Configuration

The default options are:

{
  -- The name of the subdirectory in `vim.fn.stdpath('data')`
  -- where the sessions are saved.
  -- If it does not exist, it will be created.
  directory = 'sessions', ---@type string

  -- Overwrites existing session files without confirmation.
  overwrite = true, ---@type boolean
}

For other plugin manager, call the setup function require('sessions').setup({ ... }) directly.

Usage

Command Description
:Session Shows information about the current session and the Session command
:Session save Saves the current session for the current working directory
:Session load Loads the session for the current working directory
:Session delete Deletes the session for the current working directory

Run :checkhealth sessions to check the health of the plugin.

TODO

  • Move simple session management from tigion.core.util.session to a plugin.
  • Update readme

About

A simple session management plugin for neovim.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages