27 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
  • 833
20 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
16 votes
Accepted

Detect neovim terminal from bash in bashrc

I compared the output of running env in a standard terminal to the output when running it within Neovim, and it looks like these variables are new: VIMRUNTIME=/usr/local/Cellar/neovim/HEAD/share/nvim/...
alxndr's user avatar
  • 1,356
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
16 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,827
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

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
  • 783
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
Accepted

Opening :terminal window in new buffer

Thanks to Christian Brabandt, :ter ++curwin was the thing that I want.
Muhammed Alkan's user avatar
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' ...
Steven Walton's user avatar
12 votes
Accepted

How to specify the content of a new buffer from command line?

Did you try something like this? $ echo "foo, bar, baz, and qux" | vim - Or like that? $ vim -c "put='foo, bar, baz, and qux'"
romainl's user avatar
  • 38.3k
12 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
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
  • 28.1k
11 votes

Detect neovim terminal from bash in bashrc

Aside from alxndr's example, you can set one yourself with: :let $IN_NEOVIM = "yes" :terminal $ env | grep NEOVIM IN_NEOVIM=yes This is especially useful as a simple way to pass information to the ...
Martin Tournoij's user avatar
11 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
  • 276
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,138
10 votes
Accepted

Use case for neovim terminal emulator?

Running a terminal inside Vim allows you to use Vim commands on the input and output to the programs that you run in that terminal. You get search, copy-paste, macros, syntax coloring, etc. Using :...
Gilles 'SO- stop being evil''s user avatar
10 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,586
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
  • 49k
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
  • 24.6k
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
  • 28.1k
9 votes

Terminal borked after invoking Vim with xargs

Besides reset, you can try: stty sane which should also make your terminal usable again. See here for explanations. And somehow this can be considered a vim misbehavior, at least Neovim doesn't ...
ryenus's user avatar
  • 193
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
  • 13.8k
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
  • 900
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
  • 30.9k
8 votes

Scrolling issues when the `wrap` option is set

That is an issue, that has been often requested but never been implemented. So no, there is no possibility for a better and smoother scrolling, once the lines wrap. Update: This is no longer entirely ...
Christian Brabandt's user avatar
8 votes
Accepted

Why does vim create a new file when opening an existing file?

That line: n indent on means "open the file called indent that is at the root of the working directory". Basically, you tell Vim to do something silly and… it does just that. It should be: ...
romainl's user avatar
  • 38.3k
8 votes
Accepted

I can't move around the document while editing

I do need to point out the elephant in the room: You shouldn't be navigating in insert mode. Insert mode is for inserting text. While many implementations of vi allow you to navigate (using the ...
Wildcard's user avatar
  • 4,315
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

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