All Projects ā†’ akinsho ā†’ Nvim Toggleterm.lua

akinsho / Nvim Toggleterm.lua

A neovim lua plugin to help easily manage multiple terminal windows

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to Nvim Toggleterm.lua

Gina.vim
šŸ‘£ Asynchronously control git repositories in Neovim/Vim 8
Stars: āœ­ 587 (+475.49%)
Mutual labels:  plugin, neovim
Vim Dirvish
Directory viewer for Vim āš”ļø
Stars: āœ­ 929 (+810.78%)
Mutual labels:  plugin, neovim
Vim Quickui
The missing UI extensions for Vim 8.2 (and NeoVim 0.4) !! šŸ˜Ž
Stars: āœ­ 714 (+600%)
Mutual labels:  terminal, neovim
Nnn.vim
File manager for vim/neovim powered by nĀ³
Stars: āœ­ 414 (+305.88%)
Mutual labels:  terminal, neovim
Dotfiles
My dotfiles šŸš€. Includes configs for neovim, tmux, zsh, alacritty and more.
Stars: āœ­ 47 (-53.92%)
Mutual labels:  terminal, neovim
Comfortable Motion.vim
Brings physics-based smooth scrolling to the Vim world!
Stars: āœ­ 543 (+432.35%)
Mutual labels:  plugin, neovim
Dotfiles
Configurations for the tools I use every day
Stars: āœ­ 898 (+780.39%)
Mutual labels:  terminal, neovim
Vim Sneak
The missing motion for Vim šŸ‘Ÿ
Stars: āœ­ 2,467 (+2318.63%)
Mutual labels:  plugin, neovim
Neoterm
Wrapper of some vim/neovim's :terminal functions.
Stars: āœ­ 1,007 (+887.25%)
Mutual labels:  terminal, neovim
Onehalf
Clean, vibrant and pleasing color schemes for Vim, Sublime Text, iTerm, gnome-terminal and more.
Stars: āœ­ 974 (+854.9%)
Mutual labels:  terminal, neovim
Vimpyter
Edit your Jupyter notebooks in Vim/Neovim
Stars: āœ­ 308 (+201.96%)
Mutual labels:  plugin, neovim
Sniprun
A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages
Stars: āœ­ 93 (-8.82%)
Mutual labels:  plugin, neovim
Gen tags.vim
Async plugin for vim and neovim to ease the use of ctags/gtags
Stars: āœ­ 288 (+182.35%)
Mutual labels:  plugin, neovim
Nord Tmux
An arctic, north-bluish clean and elegant tmux color theme.
Stars: āœ­ 567 (+455.88%)
Mutual labels:  terminal, plugin
Vim Yoink
Vim plugin that maintains a yank history to cycle between when pasting
Stars: āœ­ 225 (+120.59%)
Mutual labels:  plugin, neovim
Markdown Preview.vim
āš ļø PLEASE USE https://github.com/iamcco/markdown-preview.nvim INSTEAD
Stars: āœ­ 764 (+649.02%)
Mutual labels:  plugin, neovim
Vim Subversive
Vim plugin providing operator motions to quickly replace text
Stars: āœ­ 168 (+64.71%)
Mutual labels:  plugin, neovim
Aerojump.nvim
Aerojump is a fuzzy-match searcher/jumper for Neovim with the goal of quick keyboard navigation
Stars: āœ­ 184 (+80.39%)
Mutual labels:  plugin, neovim
Neoformat
āœØ A (Neo)vim plugin for formatting code.
Stars: āœ­ 977 (+857.84%)
Mutual labels:  plugin, neovim
Vim Crates
Handle Cargo dependencies like a Rustavimean.
Stars: āœ­ 54 (-47.06%)
Mutual labels:  plugin, neovim

nvim-toggleterm.lua

A neovim plugin to persist and toggle multiple terminals during an editing session

screenshot

Orientation (vertical or horizontal)

vertical orientation

Why?

Neovim's terminal is a very cool, but not super ergonomic tool to use. I find that I often want to set a process going and leave it to continue to run in the background. I don't need to see it all the time. I just need to be able to refer back to it at intervals. I also sometimes want to create a new terminal and run a few commands.

Sometimes I want these side by side, and I really want these terminals to be easy to access and not clutter my buffer list. I also want my terminal to look different from non-terminal buffers so I use winhighlight to darken them based on the Normal background colour.

This is the exact use case this was designed for. If that's your use case this might work for you. If not there are a lot of much more stable alternatives.

Why Lua?

I wrote this initially in vimscript as part of my init.vim. I then realised I wanted to extend the functionality, but didn't want to end up maintaining a bunch of vimscript I had just managed to hack into place šŸ¤·.

It sort of works fine for the exact use case above, but there are undoubtedly some niggling bugs.

Roadmap

All I really want this plugin to be is what I described above. A wrapper around the terminal functionality.

It basically (almost) does all that I need it to.

I won't be turning this into a REPL plugin or doing a bunch of complex stuff. If you find any issues, please consider a pull request not an issue. I won't be breaking my back to maintain this especially if it isn't broken "on my machine". I'm also going to be pretty conservative about what I add.

Usage

NOTE:

This plugin must now be explicitly enabled by using require"toggleterm".setup{}

Setting the key to use for toggling the terminal(s) will setup mappings for insert, normal and terminal modes If you prefix the mapping with a number that particular terminal will be opened.

require"toggleterm".setup{
  size = 20,
  open_mapping = [[<c-\>]],
  shade_filetypes = {},
  shade_terminals = true,
  shading_factor = '<number>', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
  start_in_insert = true,
  persist_size = true,
  direction = 'vertical' | 'horizontal',
}

alternatively you can do this manually (not recommended but, your prerogative)

" set
let g:toggleterm_terminal_mapping = '<C-t>'
" or manually...
autocmd TermEnter term://*toggleterm#*
      \ tnoremap <silent><c-t> <C-\><C-n>:exe v:count1 . "ToggleTerm"<CR>

" By applying the mappings this way you can pass a count to your
" mapping to open a specific window.
" For example: 2<C-t> will open terminal 2
nnoremap <silent><c-t> :<c-u>exe v:count1 . "ToggleTerm"<CR>
inoremap <silent><c-t> <Esc>:<c-u>exe v:count1 . "ToggleTerm"<CR>

Set terminal shading

This plugin automatically shades terminal filetypes to be darker than other window you can disable this by setting shade_terminals = false in the setup object

require'toggleterm'.setup{
  shade_terminals = false
}

alternatively you can set which filetypes should be shaded by setting

-- fzf is just an example
require'toggleterm'.setup{
  shade_filetypes = { "none", "fzf" }
}

setting "none" will allow normal terminal buffers to be highlighted.

Set persistent size

By default, this plugin will persist the size of the terminal split. You can disable this behaviour by setting persist_size = false in the setup object. Disabling this behaviour forces the opening terminal size to the size defined in the setup object.

require'toggleterm'.setup{
  persist_size = false
}

Statusline

In order to tell each terminal apart you can use the terminal buffer variable b:toggle_number in your statusline

" this is pseudo code
let statusline .= '%{&ft == "toggleterm" ? "terminal (".b:toggle_number.")" : ""}'

This plugin provides 2 commands

ToggleTerm

This is the command the mappings call under the hood. You can use it directly and prefix it with a count to target a specific terminal.

TermExec

This command allows you to open a terminal with a specific action. e.g. 2TermExec git status will run git status in terminal 2.

Custom commands

You can create your on commands by using the lua functions this plugin provides directly

command! -count=1 TermGitPush  lua require'toggleterm'.exec("git push",    <count>, 12)
command! -count=1 TermGitPushF lua require'toggleterm'.exec("git push -f", <count>, 12)
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].