All Projects → s1n7ax → nvim-terminal

s1n7ax / nvim-terminal

Licence: MIT license
A Lua-Neovim plugin that toggles a terminal

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to nvim-terminal

cargo-limit
Cargo with less noise: warnings are skipped until errors are fixed, Neovim integration, etc.
Stars: ✭ 105 (+94.44%)
Mutual labels:  nvim, neovim-plugin
feline.nvim
A minimal, stylish and customizable statusline for Neovim written in Lua
Stars: ✭ 867 (+1505.56%)
Mutual labels:  nvim, neovim-plugin
tabby.nvim
A declarative, highly configurable, and neovim style tabline plugin. Use your nvim tabs as a workspace multiplexer!
Stars: ✭ 232 (+329.63%)
Mutual labels:  nvim, neovim-plugin
code runner.nvim
Neovim plugin.The best code runner you could have, it is like the one in vscode but with super powers, it manages projects like in intellij but without being slow
Stars: ✭ 234 (+333.33%)
Mutual labels:  nvim, neovim-plugin
aerial.nvim
Neovim plugin for a code outline window
Stars: ✭ 485 (+798.15%)
Mutual labels:  nvim, neovim-plugin
neovim-lua-plugin-boilerplate
Starter template for creating Neovim Lua plugins
Stars: ✭ 28 (-48.15%)
Mutual labels:  nvim, neovim-plugin
nvim-highlite
A colorscheme template that is "lite" on logic for the developer.
Stars: ✭ 163 (+201.85%)
Mutual labels:  nvim, neovim-plugin
qf helper.nvim
A collection of improvements for the quickfix buffer
Stars: ✭ 70 (+29.63%)
Mutual labels:  nvim, neovim-plugin
cutlass.nvim
Plugin that adds a 'cut' operation separate from 'delete'
Stars: ✭ 78 (+44.44%)
Mutual labels:  nvim, neovim-plugin
bolt.nvim
⚡ Ultrafast multi-pane file manager for Neovim with fuzzy matching
Stars: ✭ 100 (+85.19%)
Mutual labels:  nvim, neovim-plugin
nvim-todoist.lua
Todoist plugin for Neovim in pure Lua, inspired by https://github.com/romgrk/todoist.nvim, which you should use instead
Stars: ✭ 22 (-59.26%)
Mutual labels:  nvim, neovim-plugin
nvim-startup.lua
Displays neovim startup time
Stars: ✭ 53 (-1.85%)
Mutual labels:  nvim, neovim-plugin
modes.nvim
Prismatic line decorations for the adventurous vim user
Stars: ✭ 299 (+453.7%)
Mutual labels:  nvim, neovim-plugin
awesome-neovim
Awesome Configurations for C/C++,Zig,Web and Lua development in NeoVim
Stars: ✭ 54 (+0%)
Mutual labels:  nvim, neovim-plugin
nvim-config
My neovim config
Stars: ✭ 63 (+16.67%)
Mutual labels:  nvim, neovim-plugin
firvish.nvim
WIP
Stars: ✭ 31 (-42.59%)
Mutual labels:  nvim, neovim-plugin
Lsp Status.nvim
Utility functions for getting diagnostic status and progress messages from LSP servers, for use in the Neovim statusline
Stars: ✭ 201 (+272.22%)
Mutual labels:  nvim, neovim-plugin
Coc.nvim
Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Stars: ✭ 18,268 (+33729.63%)
Mutual labels:  nvim, neovim-plugin
comment-box.nvim
✨ Clarify and beautify your comments using boxes and lines.
Stars: ✭ 91 (+68.52%)
Mutual labels:  nvim, neovim-plugin
stabilize.nvim
Neovim plugin to stabilize window open/close events.
Stars: ✭ 295 (+446.3%)
Mutual labels:  nvim, neovim-plugin

nvim-terminal

Terminal plugin to open/toggle the terminals in Neovim

demo.mp4

Features

  • Toggle terminal window
  • Quick switching between multiple terminal buffers

Install the plugin

packer

use {
    's1n7ax/nvim-terminal',
    config = function()
        vim.o.hidden = true
        require('nvim-terminal').setup()
    end,
}

Default Keymaps

leader + ; - Toggle open/close terminal

leader + 1 - Open terminal 1

leader + 2 - Open terminal 2

leader + 3 - Open terminal 3

leader + 4 - Open terminal 4

leader + 5 - Open terminal 5

leader + + - Increase window height

leader + - - Decrease window height

leader + leader + + - Increase window width

leader + leader + - - Decrease window width

Configuration

Simply pass the custom configuration to setup method

-- following option will hide the buffer when it is closed instead of deleting
-- the buffer. This is important to reuse the last terminal buffer
-- IF the option is not set, plugin will open a new terminal every single time
vim.o.hidden = true

require('nvim-terminal').setup({
    window = {
        -- Do `:h :botright` for more information
        -- NOTE: width or height may not be applied in some "pos"
        position = 'botright',

        -- Do `:h split` for more information
        split = 'sp',

        -- Width of the terminal
        width = 50,

        -- Height of the terminal
        height = 15,
    },

    -- keymap to disable all the default keymaps
    disable_default_keymaps = false,

    -- keymap to toggle open and close terminal window
    toggle_keymap = '<leader>;',

    -- increase the window height by when you hit the keymap
    window_height_change_amount = 2,

    -- increase the window width by when you hit the keymap
    window_width_change_amount = 2,

    -- keymap to increase the window width
    increase_width_keymap = '<leader><leader>+',

    -- keymap to decrease the window width
    decrease_width_keymap = '<leader><leader>-',

    -- keymap to increase the window height
    increase_height_keymap = '<leader>+',

    -- keymap to decrease the window height
    decrease_height_keymap = '<leader>-',

    terminals = {
        -- keymaps to open nth terminal
        {keymap = '<leader>1'},
        {keymap = '<leader>2'},
        {keymap = '<leader>3'},
        {keymap = '<leader>4'},
        {keymap = '<leader>5'},
    },
})

Add Keymaps Manually

nvim-terminal adds a global variable called NTGlobal. When you call require('nvim-terminal').setup() it adds terminal and window properties to NTGlobal

vim.api.nvim_set_keymap('n', '<leader>t', ':lua NTGlobal["terminal"]:toggle()<cr>', silent)
vim.api.nvim_set_keymap('n', '<leader>1', ':lua NTGlobal["terminal"]:open(1)<cr>', silent)
vim.api.nvim_set_keymap('n', '<leader>+', ':lua NTGlobal["window"]:change_height(2)<cr>', silent)
vim.api.nvim_set_keymap('n', '<leader>-', ':lua NTGlobal["window"]:change_height(-2)<cr>', silent)

PRO MODE

Default Terminal

terminal = require('nvim-terminal').DefaultTerminal;

local silent = { silent = true }

vim.api.nvim_set_keymap('n', '<leader>t', ':lua terminal:toggle()<cr>', silent)
vim.api.nvim_set_keymap('n', '<leader>1', ':lua terminal:open(1)<cr>', silent)
vim.api.nvim_set_keymap('n', '<leader>2', ':lua terminal:open(2)<cr>', silent)
vim.api.nvim_set_keymap('n', '<leader>3', ':lua terminal:open(3)<cr>', silent)

Customized Window

local Terminal = require('nvim-terminal.terminal')
local Window = require('nvim-terminal.window')

local window = Window:new({
	position = 'botright',
	split = 'sp',
	width = 50,
	height = 15
})

terminal = Terminal:new(window)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].