Utilites around neovim's
One of the coolest feature of neovim is its xterm-like terminal emulator. See
One feature that distinguishes Nvim from Vim is that it implements a mostly complete VT220/xterm-like terminal emulator. The terminal is presented to the user as a special buffer type, one that is asynchronously updated to mirror the virtual terminal display as data is received from the program connected to it. For most purposes, terminal buffers behave a lot like normal buffers with 'nomodifiable' set.
This help page also comes with a bunch of tips and recommandation. Indeed, the initial user experience within a terminal Buffer is not perfect:
No easy way to switch back to normal mode. Hitting
ior any key that would enter insert mode allows sending input to the command, but there's no easy way to switch back (for instance to close the buffer with
<C-\><C-n>key combo is the defaults.
:termwill open a terminal buffer, in the current buffer, which is often not wanted. It uses
:enewby default whereas
:vnewmight be more appropriate.
Navigating to nearby buffer / windows is not easy / handy. Maps like
<C-w>ware inactive in favor of the terminal implementation (which is in this case delete previous word)
This plugin aims to alleviate some of these issues, for a better terminal buffer experience.
Install this plugin using your favorite plugin manager, or manually by
extracting the files in your
:TermOpens a new terminal buffer using
:VTermOpens a new terminal buffer using
Both commands accept a
<count> like their
:vnew counterparts. You
can prefix both commands with a number to specifiy the buffer height / width.
Similar to the original
:terminal, both commands accepts any number of
arguments. It can be used to spawn a cmd and see the result, or even start a
:10Termwould open an horizontal buffer with 10 lines displayed, on top of the current buffer.
:100VTermwould open a vertical buffer with 10 lines displayed, right of the current buffer.
:Term npm search somethingwould open a new terminal buffer and launch a search on npm registry. This is a good candidate to appreciate the async nature of neovim (no more frozen UI!)
:2Term npm install expresswould open a minimal buffer with only two lines, immediatly invoking
npm install expresswith npm output displayed within the terminal buffer. Hit
<Enter>when done to close the buffer.
:VTerm nodewould open a vertical buffer with a node REPL started.
g:split_term_vertical- force the
:Termcommand to always use a vertical buffer (using
splitright/splitbelowoptions can be used to configure the split buffer orientation.
set splitrightwill put the new window right of the current one when using
set splitbelowwill put the new window below the current one when using
g:disable_key_mappings- disable key mappings of the plugin
The plugin remaps specifically a few keys for a better terminal buffer experience. This
behaviour can be disabled using
<Esc>- Switch to normal mode (instead of
- Bind Alt+hjkl, Ctrl+arrows to navigate through windows (eg. switching to buffer/windows left, right etc.)
Alt+h- does a
Alt+j- does a
Alt+k- does a
Alt+l- does a
Ctrl+Left- does a
Ctrl+Down- does a
Ctrl+Up- does a
Ctrl+Right- does a