83 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 ...
Dan Bradbury's user avatar
  • 1,216
25 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 ...
avimehenwal's user avatar
22 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
Tuyen Pham's user avatar
  • 1,306
22 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: +----+----+...
francismaile's user avatar
15 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 ...
Xuan's user avatar
  • 251
14 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' ...
Steven Walton's user avatar
14 votes
Accepted

Opening :terminal window in new buffer

Thanks to Christian Brabandt, :ter ++curwin was the thing that I want.
Muhammed Alkan's user avatar
10 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 (...
mrtnmgs's user avatar
  • 201
10 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 ...
filbranden's user avatar
  • 28.7k
9 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 ++...
B Layer's user avatar
  • 19.7k
9 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 &...
Matt's user avatar
  • 20.6k
8 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>
Serge Stroobandt's user avatar
8 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 ...
Martin Tournoij's user avatar
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 ...
Christian Brabandt's user avatar
8 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. ...
3N4N's user avatar
  • 5,624
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&...
Mass's user avatar
  • 14k
7 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 ...
jamessan's user avatar
  • 11k
7 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>
Ralf's user avatar
  • 9,157
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 ...
dedowsdi's user avatar
  • 6,238
6 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
Charles Gueunet's user avatar
6 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 ...
doraemon's user avatar
  • 1,667
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 ...
Matt's user avatar
  • 20.6k
5 votes

Exit from Terminal mode in Neovim/Vim 8

Another simple solution that works for neovim: If you have the mouse support, simply using the mouse wheel will switch to normal mode.
piertoni's user avatar
  • 151
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 ...
filbranden's user avatar
  • 28.7k
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 ...
Jesse Hallett's user avatar
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 ...
bossi's user avatar
  • 141
4 votes

Change the terminal emulater neovim uses

Neovim uses its own internal terminal emulator for :term. You can not change that (as far as I know). The thing you can change is the command interpreter/shell that runs in that terminal. See ...
Lucas's user avatar
  • 1,619
4 votes
Accepted

Execute visual selection/current line in Vim terminal via keymap

If you want to paste something into the terminal window, you can use the command CtrlWReg (if you are in terminal job mode). For your macro, that would be something along: qqY<C-W>w<C-W>"...
Christian Brabandt's user avatar
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.
raman's user avatar
  • 141

Only top scored, non community-wiki answers of a minimum length are eligible