122
votes
Accepted
Exit from Terminal mode in Neovim/Vim 8
You are supposed to press CTRL+\CTRL+n.
See :help terminal-emulator for a mapping suggestion.
72
votes
Exit from Terminal mode in Neovim/Vim 8
The answer by @romainl is correct but I wanted to add a bit more info for anyone that may have stumbled on this from google like I did.
Directly from the docs we get this note:
Terminal mode has its ...
20
votes
How to switch between buffer and terminal
A better way which I use (and love these days) to jump between terminal (interactive mode with all alias and path set) and vim is using CTRL+Z in normal mode. Work on terminal, and when done type fg ...
17
votes
Accepted
How to switch between buffer and terminal
From :h terminal-typing
CTRL-W can be used to navigate between windows and other CTRL-W commands, e.g.:
CTRL-W CTRL-W move focus to the next window
CTRL-W : enter an Ex command
13
votes
How could I create a terminal at the bottom
In your ~/.vimrc add the line
set splitbelow
This will cause all splits to happen below (including terminal).
To change the height of the terminal (row x col)
set termwinsize=10x0 " 'termsize' ...
11
votes
Accepted
Opening :terminal window in new buffer
Thanks to Christian Brabandt, :ter ++curwin was the thing that I want.
10
votes
How could I create a terminal at the bottom
This question is a couple of years old now but I found it when I was looking for a way to open a terminal inside vim below a bunch of vertical splits. What I want looks something like this:
+----+----+...
8
votes
Exit from Terminal mode in Neovim/Vim 8
According to vim documentation, there are two ways:
CTRL-W N (note it's uppercase N)
CTRL-\ CTRL-n
Use CTRL-W N (or 'termwinkey' N) to switch to Terminal-Normal mode.
Now the contents of the ...
8
votes
Accepted
Is it possible to change the statusline color in Vim 8 terminal windows?
The still somewhat new internal terminal implementation of Vim 8 uses the StatusLineTerm highlighting group for the active window and the StatusLineTermNC highlighting group for the statusline of an ...
8
votes
Accepted
Vim terminal: How to split below by default?
Use :belowright:
:belowright terminal
Or, more succinctly:
:bel term
This command is a modifier and affects the command run right after it.
(Another useful modifier here is :vertical, to split ...
7
votes
How to switch between buffer and terminal
After opening a terminal window within vim with :te[rminal] and switching to insert mode (needed to type in the terminal), all keys are sent to the terminal, so esc doesn't switch back to normal mode (...
7
votes
Accepted
make :terminal use the current pane
You can replace the current window with a terminal using
:terminal ++curwin
:ter ++curwin " shorter form
You can create a mapping or command for convenience
nnoremap \t :terminal ++curwin<cr&...
7
votes
Exit from Terminal mode in Neovim/Vim 8
Exit & close
tnoremap <Esc> <C-\><C-n>:q!<CR>
In Vim 8, this also works:
tnoremap <ESC> <C-w>:q!<CR>
7
votes
How to close and and delete terminal buffer if programs exited?
From vim/src/eval.c:
static void eval_job_process_exit_cb(Process *proc, int status, void *d) {
[..]
if (data->term && !data->exited) {
data->exited = true;
char ...
7
votes
Accepted
Is there a way to start vim in terminal mode?
I assume you aren't literally asking for a --start-terminal flag :) ...but you can specify a command for Vim to run after it starts up using the -c flag.
So this should be as easy as
vim -c ':term ++...
7
votes
Accepted
NeoVim - Go into insert mode when clicking in a terminal in a pane?
Neovim's terminal has "a specialty": a mouse click automatically switches it to "Terminal-Normal" mode. (BTW. That's not a case for Vim, so it does not suffer from this issue.)
So it won't work from &...
7
votes
Accepted
Parsing winlayout() For Toggling Multiple Windows At Once
Full restore
If you want to restore layout with multiple termina buffers, you must restore other windows and buffers too, so it's in fact a full buffer layout restore, it's usage is not limited to ...
6
votes
Accepted
Unmapping the global mappings on a per-buffer basis
You could overwrite the mapping by a buffer-local mapping. Just map <ESC> to <ESC>:
tnoremap <buffer> <ESC> <ESC>
6
votes
Accepted
How to keep the neovim terminal buffer in the buffer list even after it being hidden
Put the following in ~/.config/nvim/init.vim:
augroup custom_term
autocmd!
autocmd TermOpen * setlocal bufhidden=hide
augroup END
I don't know if it's enough, but it is working for now. ...
6
votes
Accepted
Making terminal buffer unlisted
First, your function can be simplified into
let bufnr = term_start(&shell, {"hidden": 1})
Second, it's not a problem to have buftype ==# 'terminal' and set nobuflisted together, as these are two ...
5
votes
How to change buffer name for NeoVim Terminal special buffer
You can change the name of any buffer by using the :file {name} command. However, doing so changes that alternate-file to the previous name, which you may not want in this case. The :keepalt command ...
5
votes
Accepted
Is it possible to use <C-H> (and J/K/L) for navigation inside a Vim 8 terminal?
You need to use :tnoremap to map keys in the :terminal window.
So if you want that to work in both normal mode of a regular buffer and of terminal windows, you need to add another set of mappings for ...
4
votes
neovim: how to close the terminal buffer by just pressing enter?
I ran into a similar (the same?) issue on two different installs:
NVIM v0.2.0
NVIM v0.3.1
As quanta already mentions this change in behavior might be due to the changes introduced in NVIM v0.2.1.
I ...
4
votes
How to close and and delete terminal buffer if programs exited?
This is my solution for closing terminal windows automatically when the terminal process completes with 0 exit status.
Using Martin Tournoij's answer as a starting point I did some investigating on ...
4
votes
Switching buffers in VI while skipping any terminal in VI 8.1
This should work too:
augroup termIgnore
autocmd!
autocmd TerminalOpen * set nobuflisted
augroup END
4
votes
How could I adjust terminal height
To open a terminal for running command with height 20 you can do
:new +resize20 term://command
If the terminal is ready created, you either use :resize 20 or 20<c-w>_ for height. :vertical ...
4
votes
How to go up to previous command when in terminal mode in Vim 8?
One other thing that you can do is use <Ctrl-P> to go to the 'Previous' command. This is also works in bash terminals. You can also do <Ctrl-N> to go to the 'Next' command.
4
votes
Accepted
How can I change the colorscheme of the vim terminal buffer?
In GVim, you can control the 16 ANSI colors used by your terminal with the g:terminal_ansi_colors variable.
See :help g:terminal_ansi_colors:
In GUI mode or with 'termguicolors', the 16 ANSI ...
4
votes
How can I change the colorscheme of the vim terminal buffer?
In modern vim/neovim there is :h g:terminal_ansi_colors (vim) or 16 of g:terminal_color_0 .. g:terminal_color_15 (neovim).
If you open gruvbox colorscheme you use, you will find those definitions ...
4
votes
Accepted
Close vim 8.1+ terminal buffer without unloading
Terminal buffer is special:
When the job has finished and no changes were made to the buffer: closing the
window will wipe out the buffer.
Change buffer type will stop this.
Manual
After job ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
terminal-buffer × 125terminal × 37
neovim × 34
vimscript × 11
buffers × 11
key-bindings × 9
vimrc × 7
vim-windows × 6
vim8 × 5
cursor × 4
command-line × 3
gvim × 3
colorscheme × 3
microsoft-windows × 3
sessions × 3
makeprg × 3
job-control × 3
cut-copy-paste × 2
autocmd × 2
split × 2
quickfix × 2
tabbed-user-interface × 2
tmux × 2
color × 2
original-vim × 2