Skip to content

Simple plugin to toggle a floating terminal window with customizable starting program

License

Notifications You must be signed in to change notification settings

MiConnell/termplug.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Termplug.nvim

Simple neovim plugin to toggle a floating terminal window with customizable starting program



Screenshot 1

⚙️ Features

  • ~0ms load time
  • <100 lines of Lua
  • simple to setup and customize

This plugin exposes to the user only one function:

  • toggle("optional: process_name") - opens (toggles) terminal window with given process (opens bash by default)

📦 Installation

{ "MiConnell/termplug.nvim" }
use "MiConnell/termplug.nvim"
add("MiConnell/termplug.nvim")

🚀 Usage

Firstly, call the setup function with optional config (see configuration options below):

require("termplug").setup()

In your init.lua, set the mapping to toggle a terminal window:

vim.keymap.set({ "n", "t" }, "<A-i>", "<cmd> Term <CR>")

If you want to toggle different process, eg. lazygit use:

vim.keymap.set({ "n", "t" }, "<C-g>", "<cmd> Term lazygit <CR>")

🔧 Configuration

There are only three configuration options: width, height, and shell.

width controlls how wide the popup window will be. Takes values from 0.0 to 1.0 (defaults to 0.65). height controlls how wide the popup window will be. Takes values from 0.0 to 1.0 (defaults to 0.45). shell controlls which shell you would like to open (bash, zsh, tmux, etc.) if you don't pass any arguments to :Term (defaults to zsh)

Set the size value to 1 for a full screen terminal popup.

{ "MiConnell/termplug.nvim", config = { size = 0.5, shell = "zsh" } },
use {
    "MiConnell/termplug.nvim",
    config = function()
        require("termplug").setup{ size = 0.5, shell = "tmux" }
    end
}
later(function()
    add("MiConnell/termplug.nvim")
    require("termplug").setup({ size = 0.5, shell = "fish" })
end)

⚡ Requirements

  • Neovim >= v0.7.0

About

Simple plugin to toggle a floating terminal window with customizable starting program

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%