Skip to content

marco-souza/term.nvim

Repository files navigation

term.nvim

Latest release Last commit Latest Neovim Made with Lua

A Neovim plugin for managing multiple terminal sessions with an interactive dashboard. Run, monitor, and control multiple terminal instances directly from your editor.

Features

  • Manage multiple terminal sessions simultaneously
  • Interactive dashboard with dual-pane layout
    • Left panel: Terminal session list with status indicator (20% width)
    • Right panel: Active terminal display with full terminal emulation (80% width)
  • Commands: :Term <cmd>, :Term, :Term list
  • Create, switch, and close terminal sessions
  • Rename sessions and navigate between them
  • Sessions persist after dashboard closure
  • Seamless integration with nui.nvim and plenary.nvim

Dependencies

Installation

Install with your preferred package manager:

Using lazy.nvim

{
  "marco-souza/term.nvim",
  dependencies = {
    "MunifTanjim/nui.nvim",
    "nvim-lua/plenary.nvim"
  },
  config = function()
    require("term").setup()
  end,
}

Usage

Commands

The plugin provides the following commands:

  • :Term <cmd> - Create and open a terminal with the specified command
  • :Term - Open the dashboard with all active sessions
  • :Term list - List all active terminal sessions in a notification

Examples

:Term npm start           " Creates and displays a new terminal running npm start
:Term python script.py    " Creates a terminal running a Python script
:Term                     " Opens the dashboard with all active sessions
:Term list                " Shows list of all active terminals

Dashboard Navigation

Once the dashboard is open, you have a dual-pane interface:

Left Panel - Session List

  • Shows all active terminal sessions
  • * marker indicates the currently active session
  • Displays useful keybindings reference

Right Panel - Terminal

  • Full terminal emulation
  • All keyboard input is forwarded to the terminal
  • Terminal persists when dashboard is closed

Keybindings

Session Navigation (all modes)

Key Action
<S-j> Switch to next session
<S-k> Switch to previous session
<S-r> Rename current session
<S-x> Delete current session

Terminal Mode

  • All keys are forwarded to the active terminal
  • Navigation shortcuts still work while in terminal

Configuration

Setup with default options:

require("term").setup({
  margin = 2,                    -- Margin around dashboard (default: 2)
  width = 120,                   -- Dashboard width in characters (default: 120)
  height = 30,                   -- Dashboard height in lines (default: 30)
  border = "rounded",            -- Border style: "rounded", "solid", "double", "dashed", "dotted" (default: "rounded")
  default_shell = "/bin/bash",   -- Default shell command (default: $SHELL or "/bin/bash")
  auto_focus_terminal = true,    -- Auto-enter terminal mode on open (default: true)
  session_list_width = "20%",    -- Session list panel width (default: "20%")
  terminal_width = "80%",        -- Terminal panel width (default: "80%")
})

Architecture

The plugin is organized as follows:

lua/term/
├── init.lua           # Plugin entry point
├── cmd.lua            # Command definitions and routing
├── types.lua          # Type definitions
├── ui/
│   └── dashboard.lua  # Dashboard UI (nui.nvim layout)
└── utils/
    └── terminal.lua   # Terminal session management

Session Lifecycle

  1. Create: Use :Term <cmd> to spawn a new session
  2. Manage: Sessions are tracked independently and can be switched via dashboard
  3. Persist: Sessions continue running even after dashboard is closed (auto-closes on WinLeave)
  4. Close: Delete sessions with <S-x> or by exiting the terminal

All sessions are stored in memory and persist for the current Neovim session.

License

MIT License. See LICENSE for details.

About

Plugin for managing terminal in neovim

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •