charludo/projectmgr.nvim

website github github
telescopesessionpluginutilityprojectstartup
stars 123
issues 3
subscribers 3
forks 5
CREATED

2022-06-16

UPDATED

8 months ago


 

📜 Features

  • create a list of projects, then quickly switch between them
  • automate startup and shutdown tasks for each project:
    • pull from a remote when entering the project
    • custom startup command and/or script
    • custom shutdown command and/or script
  • save and restore sessions and shada files on a per-project base
  • reopen last opened project (if you exited vim from within a project)
  • freely configurable, disable any unwanted feature(s)
  • if you are already using telescope.nvim, this plugin will integrate with it OOTB

 

📽 Demo

Demo Gif

 

📦 Installation

The plugin is straightforward to install, so feel free to use your favorite plugin manager, e.g.:

Packer:

use { 'charludo/projectmgr.nvim' }

Lazy:

{
  'charludo/projectmgr.nvim',
  lazy = false, -- important!
}

 

⚙️ Configuration

projectmgr default configuration:

{
  autogit = {
    enabled = false,
    command = "git pull --ff-only",
  },
  reopen = false,
  session = { enabled = true, file = "Session.vim" },
  shada = { enabled = false, file = "main.shada" },
  scripts = {
    enabled = true,
    file_startup = "startup.sh",
    file_shutdown = "shutdown.sh",
  },
}

It's a good idea to set up a key mapping to toggle the projectmgr window:

vim.api.nvim_set_keymap("n", "<leader>p", ":ProjectMgr<CR>", {})

 

🦑 Usage with telescope.nvim

:ProjectMgr (or your keybind) toggles a telescope picker with your projects. The telescope preview displays information about your project and its current git state. (I'm very much open to adding more info here and am happy about suggestions!)

The following actions and keybinds are available:

Key Action
<CR> Open the project under your cursor
<C-a> Add a project. You will be asked for a name, a path, and optionally startup and shutdown commands.
<C-d> / <C-x> Delete project under your cursor
<C-e> / <C-u> Edit the project under your cursor
<C-q> / <ESC> Close the window without doing anything

 

🦑 Usage without telescope.nvim

projectmgr comes with a fallback window in case you aren't using telescope.nvim. The same actions are available. The keybinds are slightly different: <C-a> is replaced by just a, <C-q> becomes just q, and so on.