Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

floatyterm.nvim

A small Neovim plugin for persistent, tabbed floating terminals.

Open a floating terminal, spawn as many "tabs" inside it as you like, jump between them by number, and toggle the window away without killing your shell sessions.

Features

  • Single floating terminal window, centered over the editor
  • Multiple terminal "tabs" inside that one window, each a real, persisted shell job (hiding the window doesn't kill the process)
  • Jump straight to tab N with <C-N> from terminal mode
  • A minimal winbar tab strip that highlights the active tab (TermtabsActive / TermtabsInactive, linked to your colorscheme's TabLineSel / TabLine by default)
  • Fully remappable keys, sensible defaults
  • Zero dependencies, one Lua file

Installation

{
  "R3DST0RM/floatyterm.nvim",
  opts = {},
}

Or with an explicit setup() call if you want to run other code afterwards:

{
  "R3DST0RM/floatyterm.nvim",
  config = function()
    require("floatyterm").setup({
      -- your options here
    })
  end,
}
use({
  "R3DST0RM/floatyterm.nvim",
  config = function()
    require("floatyterm").setup()
  end,
})
Plug 'R3DST0RM/floatyterm.nvim'
require("floatyterm").setup()

Usage

By default, <leader>fy toggles the floating terminal. Inside the terminal:

Key Mode Action
<leader>fy Normal Toggle the floating window
q Normal Hide the window (terminal keeps running)
<C-t> Terminal Open a new tab
<C-l> Normal Next tab
<C-h> Normal Previous tab
<C-1><C-9> Terminal Jump to tab 1–9
<C-x> Normal Kill the current tab (stops the job)
<C-q> Terminal Exit terminal mode (like <C-\><C-n>)

Note: close_key, next_key, and prev_key are mapped in normal mode on the terminal buffer, while goto_prefix, new_tab_key, and exit_key are mapped in terminal mode — match this if you remap them.

Commands

Command Equivalent to
:FloatytermToggle require("floatyterm").toggle()
:FloatytermNew require("floatyterm").new_tab()
:FloatytermNext require("floatyterm").next_tab()
:FloatytermPrev require("floatyterm").prev_tab()
:FloatytermKill require("floatyterm").close_selected_tab()
:FloatytermGoto {n} require("floatyterm").goto_tab(n)

Configuration

These are the defaults — pass any subset of them to setup():

require("floatyterm").setup({
  width = 0.8,             -- float width, as a fraction of columns
  height = 0.8,             -- float height, as a fraction of lines
  border = "rounded",       -- any value accepted by nvim_open_win()'s `border`
  shell = nil,               -- nil => vim.o.shell
  open_mapping = "<leader>fy",
  close_key = "q",
  next_key = "<C-l>",
  prev_key = "<C-h>",
  goto_prefix = "<C-",      -- combined with 1-9 and ">" for terminal-mode jumps
  new_tab_key = "<C-t>",
  exit_key = "<C-q>",
  kill_key = "<C-x>",
})

Set any key option to false/nil to disable that mapping.

Highlight groups

Group Default link Purpose
TermtabsActive TabLineSel Active tab in the winbar
TermtabsInactive TabLine Inactive tabs in the winbar

Override them from your colorscheme or after/ config, e.g.:

vim.api.nvim_set_hl(0, "TermtabsActive", { fg = "#1e1e2e", bg = "#89b4fa", bold = true })

Lua API

If you'd rather wire up your own keymaps instead of using the built-in ones:

local floatyterm = require("floatyterm")

floatyterm.open()               -- open/focus the float
floatyterm.close()              -- hide the float (job keeps running)
floatyterm.toggle()             -- toggle open/closed
floatyterm.new_tab()            -- open a new terminal tab
floatyterm.next_tab()           -- cycle to next tab
floatyterm.prev_tab()           -- cycle to previous tab
floatyterm.goto_tab(3)          -- jump to tab 3
floatyterm.close_selected_tab() -- kill and remove the current tab

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages