https://github.com/ernest1338/termplug.nvim
Simple plugin to toggle a floating terminal window with customizable starting program
https://github.com/ernest1338/termplug.nvim
lua lua-plugin neovim neovim-lua neovim-lua-plugin neovim-plugin plugin terminal
Last synced: 5 months ago
JSON representation
Simple plugin to toggle a floating terminal window with customizable starting program
- Host: GitHub
- URL: https://github.com/ernest1338/termplug.nvim
- Owner: Ernest1338
- License: mit
- Created: 2023-02-26T19:58:17.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-26T09:07:38.000Z (over 1 year ago)
- Last Synced: 2024-08-27T00:20:30.125Z (over 1 year ago)
- Topics: lua, lua-plugin, neovim, neovim-lua, neovim-lua-plugin, neovim-plugin, plugin, terminal
- Language: Lua
- Homepage:
- Size: 7.81 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Termplug.nvim
Simple neovim plugin to toggle a floating terminal window with customizable starting program

## ⚙️ 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
- With [folke/lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{ "Ernest1338/termplug.nvim" }
```
- With [wbthomason/packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use "Ernest1338/termplug.nvim"
```
- With [echasnovski/mini.deps](https://github.com/echasnovski/mini.deps)
```lua
add("Ernest1338/termplug.nvim")
```
## 🚀 Usage
Firstly, call the `setup` function with optional config (see configuration options below):
```lua
require("termplug").setup()
```
In your init.lua, set the mapping to toggle a terminal window:
```lua
vim.keymap.set({ "n", "t" }, "", " Term ")
```
If you want to toggle different process, eg. lazygit use:
```lua
vim.keymap.set({ "n", "t" }, "", " Term lazygit ")
```
## 🔧 Configuration
There are only two configuration options: `size` and `shell`.
`size` controlls how big will be the popup window. Takes values from `0.0` to `1.0` (defaults to 0.9).
`shell` controls which default shell to open (bash, zsh, tmux, etc.) when no arguments are passed to `:Term` (defaults to `bash`)
**Set the size value to `1` for a full screen terminal popup.**
- For [folke/lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{ "Ernest1338/termplug.nvim", config = { size = 0.5, shell = "zsh" } },
```
- For [wbthomason/packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use {
"Ernest1338/termplug.nvim",
config = function()
require("termplug").setup{ size = 0.5, shell = "tmux" }
end
}
```
- For [echasnovski/mini.deps](https://github.com/echasnovski/mini.deps)
```lua
later(function()
add("Ernest1338/termplug.nvim")
require("termplug").setup({ size = 0.5, shell = "fish" })
end)
```
## ⚡ Requirements
- Neovim >= **v0.7.0**
## ❔ Why
Because I wanted a simple plugin to toggle a popup terminal window with a mapping and every existing terminal plugins seem over complicated.
Combined with the ability to choose which process to execute, this plugin became not only a terminal plugin
but it can also toggle a popup window with any TUI application of your choosing.
For simplicity, it supports toggling only one of each process (one bash, one lazygit, ...) at a time.