Giter Site home page Giter Site logo

ernest1338 / termplug.nvim Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 7 KB

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

License: MIT License

Lua 100.00%
lua lua-plugin neovim neovim-lua neovim-plugin plugin neovim-lua-plugin terminal

termplug.nvim's Introduction

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

{ "Ernest1338/termplug.nvim" }
use "Ernest1338/termplug.nvim"
add("Ernest1338/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 is only one configuration option: size.

It controlls how big will be the popup window. Takes values from 0.0 to 1.0 (defaults to 0.9).

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

{ "Ernest1338/termplug.nvim", config = { size = 0.5 } },
use {
    "Ernest1338/termplug.nvim",
    config = function()
        require("termplug").setup{ size = 0.5 }
    end
}
later(function()
    add("Ernest1338/termplug.nvim")
    require("termplug").setup({ size = 0.5 })
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.

termplug.nvim's People

Contributors

ernest1338 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

termplug.nvim's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.