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 ...
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:
+----+----+...
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/...
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 ...
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 "...
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:
...
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 $...
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 ...
14
votes
Accepted
Opening :terminal window in new buffer
Thanks to Christian Brabandt, :ter ++curwin was the thing that I want.
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' ...
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'"
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 ...
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 ...
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 ...
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 ...
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)
...
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 :...
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 ...
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 ...
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-...
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
\ ...
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 ...
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 ...
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.
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 ...
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 ...
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 ...
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:
...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
terminal × 433neovim × 75
vimrc × 52
key-bindings × 51
colorscheme × 44
terminal-buffer × 42
macos × 23
vimscript × 20
gvim × 16
microsoft-windows × 16
cursor × 16
syntax-highlighting × 15
shell × 15
external-command × 13
tmux × 13
cut-copy-paste × 12
vim8 × 12
linux × 11
color × 11
command-line × 10
iterm2 × 10
buffers × 9
macvim × 9
mouse × 9
autocmd × 8