sanathks / workspace.nvim

Neovim project manager, manage project within workspaces using Tmux sessions
42 stars 6 forks source link

workspace.nvim

License

workspace.nvim is a Neovim plugin that allows you to manage Tmux sessions for your projects and workspaces in a simple and efficient way.

workspace.nvim

Introduction

Inspired by ThePrimeagen's tmux-sessionizer

Features

Installation

lazy.nvim

{
  "sanathks/workspace.nvim",
  dependencies = {"nvim-telescope/telescope.nvim"},
  config = function()
    require("workspace").setup({
      workspaces = {
        { name = "Work",  path = "~/projects/work",  keymap = { "<leader>w" } },
        { name = "Hobby", path = "~/projects/hobby", keymap = { "<leader>p" } },
      }
    })
  end,
}

Switch between tmux sessions

tmux sessions

 local workspace = require("workspace")
 vim.keymap.set('n', '<leader>ps', workspace.tmux_sessions)

Customize the session name generation

with the tmux_session_name_generator option you can provide a custom session name generator, which allows you to make the session name unique across multiple workspaces.

function(project_name, workspace_name)
   local suffix = string.sub(workspace_name, 1, 2)
   local session_name = string.upper(project_name) .. "_" .. suffix
    return session_name
end

Contributing

Contributions are welcome! If you find any issues or have ideas for improvements, please open an issue or submit a pull request.