Giter Club home page Giter Club logo

nvim-toggle-terminal's Introduction

Toggle terminal buffer or create new one if there is none. It keeps the shell session between toggles.

You have to set your own key bindings. For example:

nnoremap <silent> <C-z> :ToggleTerminal<Enter>
tnoremap <silent> <C-z> <C-\><C-n>:ToggleTerminal<Enter>

Commands

Command Description
:ToggleTerminal Toggles a terminal which is the same shell instance regardless of where it is called
:ToggleTabTerminal Toggles a tab specific terminal instance. It will have a different shell session for each tab
:ToggleWindowTerminal Toggles a window specific terminal instance. It will have a different shell session for each window

Settings

Setting Description Default
g:preserve_alternate_buffer Preserve the alternate_buffer of the current window when opening and closing the terminal 1
g:auto_start_insert enter insert mode automatically when given focus. Uses BufEnter event 0
g:open_in_insert_mode start in insert mode when you open the terminal. Uses BufWinEnter event 1

Instalation

Use your favourite plugin manager. For example, using Plug:

call plug#begin()
Plug 'caenrique/nvim-toggle-terminal'
call plug#end()

Other useful settings

Some extra setting that can be used in conjuction with this plugin for convenience:

Make your life easier by mapping ESC in terminal mode. And if you use fzf, this will not break the ESC behaviour:

tnoremap <expr> <Esc> (&filetype == "fzf") ? "<Esc>" : "<c-\><c-n>"

Use this to switch back and forth between files and terminal without the anoying No write since last change (add ! to override) message with unsaved changes:

set autowriteall

Use nvr to avoid nesting nvim in Terminal buffers. This should go in your .bashrc or similar:

nvim_wrapper() {
  NVIM=`which nvim`
  if test -z $NVIM_LISTEN_ADDRESS; then
      $NVIM $@
  else
    if test -z $@; then
        nvr -l -c new
    else
        nvr -l $@
    fi
  fi
}
alias nvim="nvim_wrapper"

nvim-toggle-terminal's People

Contributors

caenrique avatar chromosore avatar

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.