explaingit

akinsho/toggleterm.nvim

5,499LuaAudience · developerComplexity · 2/5Setup · easy

TLDR

A Neovim plugin that lets you toggle terminal windows open and closed with a single key, supports multiple named terminals in horizontal, vertical, floating, or tab layouts, and can send commands to the terminal from the editor.

Mindmap

mindmap
  root((repo))
    What it does
      Toggle terminal open
      Hide and restore
      Multiple terminals
    Display Styles
      Horizontal split
      Vertical split
      Floating panel
      Tab view
    Features
      Send commands to terminal
      Numbered terminals
      Directory sync
    Setup
      Lua config
      Custom keybindings
      Neovim 0.7 plus
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Open and close a terminal inside Neovim with one key without losing the running process, such as a test watcher or build script

USE CASE 2

Keep multiple numbered terminal sessions open at the same time and switch between them while editing code

USE CASE 3

Send a test command directly from the Neovim editor to a terminal window without switching focus or retyping the command

Tech stack

LuaNeovim

Getting it running

Difficulty · easy Time to first run · 30min

Requires Neovim 0.7 or newer. Install through any standard Neovim plugin manager. Configure via a Lua setup() call.

No explicit license mentioned in the explanation.

In plain English

toggleterm.nvim is a plugin for Neovim, a keyboard-driven code editor, that makes it easier to open, hide, and switch between terminal windows while editing. Neovim has a built-in terminal, but opening and managing multiple terminal sessions inside the editor can be awkward. This plugin adds a simple toggle mechanism: press a key to open a terminal, press it again to hide it, and it stays running in the background with whatever process you left in it. The plugin supports four display styles. A terminal can open as a horizontal split below the editor, a vertical split to the side, a floating panel over the editor, or in its own tab. Each style can be set as the default, or individual terminals can be opened in a specific layout on demand. Multiple numbered terminals can be open at the same time, and a key prefix lets you target a specific one. Beyond simple toggling, the plugin can send commands directly to a terminal window from the editor, which is useful for running test suites, build scripts, or a language's interactive console without leaving the editor or typing the same command manually each time. Configuration is done in Lua using a setup call. Options cover the terminal size, which keyboard shortcut triggers the toggle, visual styling such as background shading, whether the terminal starts in insert mode, whether it changes directory when Neovim does, and callbacks for when the terminal opens, closes, or exits. The plugin requires Neovim 0.7 or newer and is installed through any of the standard Neovim plugin managers. The author describes it as a focused tool that wraps the terminal feature rather than a full interactive programming environment, and is intentionally conservative about adding new features. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
How do I install toggleterm.nvim with lazy.nvim and set it up so pressing <C-t> toggles a floating terminal in Neovim?
Prompt 2
Show me the Lua config for toggleterm.nvim that opens terminal 1 with <C-1> and terminal 2 with <C-2> as vertical splits.
Prompt 3
How do I use toggleterm.nvim to automatically run `npm test` in a horizontal split terminal every time I save a JavaScript file in Neovim?
Prompt 4
I want toggleterm.nvim to always start in insert mode and match Neovim's working directory. What options do I set in the setup call?
Open on GitHub → Explain another repo

← akinsho on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.