Skip to main content
Share Your Experience: Take the 2024 Developer Survey
30 votes
Accepted

Why doesn't my numpad work right in my terminal?

Short answer Turn off “application keypad mode switching.” Terminal-specific instructions PuTTY (also here): Terminal > Features > uncheck Disable application keypad mode SecureCRT: Session ...
Jacktose's user avatar
  • 873
24 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
20 votes
Accepted

What's t_TE and t_TI added by vim 8?

t_TI and t_TE are terminal options. You can set them with sequences which will be sent by Vim to the terminal when the latter is resp. put into "raw" mode, or when it's made to quit "...
user938271's user avatar
  • 5,987
16 votes
Accepted

How to restore bash terminal title if using 'set title' in vim?

Use the titleold setting: " Update term title but restore old title after leaving Vim set title set titleold= From :help 'titleold': This option will be used for the window title when exiting Vim ...
Martin Tournoij's user avatar
15 votes

Can Vim interpret terminal color escape codes?

If you have a sufficiently modern vim that has the +terminal feature, you can do :term cat somefile and you'll get a buffer with all the terminal codes interpreted. This might work better on large ...
Marius Gedminas's user avatar
15 votes
Accepted

How to run internal Vim terminal at current file's dir?

I am grateful to @statox for useful hints, but as I don't wont to change current dir each time I come to following: map <F6> :let $VIM_DIR=expand('%:p:h')<CR>:terminal<CR>cd $...
ephemerr's user avatar
  • 853
14 votes

How to map Alt key?

Similar to Kossak's answer but a bit simpler, by mapping literal key presses. Either in normal mode after pressing :, or inserted into your .vimrc, map the input directly by starting the mapping: ...
Walf's user avatar
  • 294
14 votes
Accepted

Up arrow key code, why '^[[A' becomes '^[OA'?

You can paste Vim's builtin termcap database in the current buffer with the following command: put =execute('set termcap') In it, you should find the text t_ku <Up> ^[OA, which means that when ...
user786441's user avatar
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' ...
MaybeALlama'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
12 votes

Ctrl-W at :terminal (default terminal behavior expected)

You can set 'termwinkey' to a sequence other than <C-W> to use a different keystroke to access the special sequences on the terminal. For example: set termwinkey=<C-X> Or: set ...
filbranden's user avatar
  • 29k
11 votes

Make vim show all the colors

The colorscheme must be missing cterm definitions, the full highlight command should look like: hi Normal cterm=NONE ctermfg=15 ctermbg=7 gui=NONE guifg=White guibg=grey20 If your terminal supports ...
LEI's user avatar
  • 1,636
11 votes
Accepted

how to change local directory of terminal buffer whenever its shell change directory

Create a special function in your vimrc that's callable from terminal, its name must start with Tapi_. " arglist : [ cwd ] " change window local working directory function! Tapi_lcd(bufnum, arglist) ...
dedowsdi's user avatar
  • 6,268
10 votes

VIM: how to send entire line to a buffer of type "Terminal"?

Here is a solution using Vim's term_sendkeys() open a vim terminal and start the REPL check which buffer the terminal is in with :ls this example assumes the terminal is in buffer 2 cmd to copy the ...
DC Slagel's user avatar
  • 266
10 votes

How to run internal Vim terminal at current file's dir?

See :h :cd and :h :lcd. :cd changes the current directory for all the windows while :lcd changes the current directory for the current window. You can change the current directory to the directory ...
statox's user avatar
  • 50.1k
10 votes
Accepted

Neovim Gray Background

A quick rundown on colorschemes See :help :colorscheme. Essentially it sources a file containing :highlight commands. What are highlight commands? Statements of the form :hi[ghlight] [default] {group-...
D. Ben Knoble's user avatar
  • 26.4k
10 votes

How to set a colorscheme that still shows spelling errors?

Here is a bit more complete answer to address this annoyance: " Force to use underline for spell check results augroup SpellUnderline autocmd! autocmd ColorScheme * \ highlight SpellBad \ ...
Osamu Aoki's user avatar
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
  • 29k
9 votes

How to use WSL's bash shell as default terminal of gvim/windows 10?

GVim is a 32-bit application and WSL must run on 64 bit. On Windows 10 you can use GVim with WSL if you add the following to your vimrc file: if has("win32") set shell=C:\Windows\Sysnative\wsl....
jtourlamain's user avatar
9 votes

How to test for :terminal support?

You can use if exists(':terminal') to check for existence of the terminal command. This works in both vim and neovim.
Mass's user avatar
  • 14.1k
9 votes

Pasting text on Vim inside tmux breaks indentation

Manually toggling :set paste/:set nopaste as suggested by francois P is cumbersome, and resetting the TERM variable as evaristegd suggests is a very bad idea as explained in the comments (which hint ...
Dining Philosopher's user avatar
9 votes
Accepted

Job still running in buffer while :qa

Running process in a terminal buffer is treated mostly the same way as "an unsaved file". So you can do :qa! or :set confirm etc.etc. Well, anything to allow exit from Vim with buffers unsaved. But, ...
Matt's user avatar
  • 20.8k
8 votes

Change cursor shape in different terminals

As of November 2017, all the terminals you are using support the same DECSCUSR escape sequences for changing the cursor shape1. So you don't need to test for the different terminals. As such, the ...
Rich's user avatar
  • 32.1k
8 votes

Terminal borked after invoking Vim with xargs

The reason is that xargs sets stdin to /dev/null, whereas vim needs stdin to be /dev/tty. BSD xargs (e.g. Mac) solution: echo -e 'file1\nfile2' | xargs -o vim -o sets the stdin of xarg's child ...
wisbucky's user avatar
  • 950
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 set a colorscheme that still shows spelling errors?

I'm going to take a stab in the dark and suggest that your configuration is probably resulting in no highlighting. You can check this with the command :verbose highlight SpellBad: if the xxx at the ...
Rich's user avatar
  • 32.1k
8 votes
Accepted

Neovim-Qt: environment variable TERM not set

The TERM environment variable is generally set by the terminal emulator you're running in, and it tells programs using curses (like Vim and Neovim) what sequences to send to the screen to do things ...
bk2204's user avatar
  • 206
8 votes
Accepted

Ctrl-W at :terminal (default terminal behavior expected)

To send the original keystroke, you can use <C-w>. (note the period). That said, I too find it annoying to have to remember. Useful reference: https://vimhelp.org/terminal.txt.html#terminal-...
D. Ben Knoble's user avatar
  • 26.4k
8 votes
Accepted

How to run terminal command in interactive mode from NeoVim?

Short answer: use :terminal {command} for interactive stuff. Long answer: neovim’s :! actually communicates via subprocesses and the commands are not directly interactive due to the way the IO streams ...
D. Ben Knoble's user avatar
  • 26.4k
7 votes

Can Vim interpret terminal color escape codes?

Building on the previous answer, with this bash function you can open vim and the required file will be displayed with colours instead of codes in a new window "a little bit later" (...
drkicknrush's user avatar

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