77 votes
Accepted

How to map Alt key?

That's how I do it on Linux or Cygwin: First check what chars are sent by your terminal when you press ALT+J: In order to do this I go to console and run sed -n l (you can also use cat for it). Then I ...
user avatar
  • 1,468
44 votes

Can Vim interpret terminal color escape codes?

There are various plugins which allow you to view ANSI colours through escape codes: AnsiEsc.vim – :AnsiEsc. Colorizer – :ColorToggle. If you want to remove all escape codes, you could use: :%s/<...
user avatar
42 votes
Accepted

Can the split separator in vim be less than a full column wide?

You are wrong about tmux. Like every terminal-based program — including Vim — it only draws stuff inside cells. This means that Vim and tmux both use the same method to draw vertical borders: they ...
user avatar
  • 32.8k
32 votes
Accepted

Can I use a non-monospaced font in either Vim or gVim?

I found mlterm, which supports this. Aside from Emacs' built-in terminal (M-x term) this is the only terminal I've found that supports this (I've tried about 15-20 different ones). I've found that ...
user avatar
30 votes

Terminal borked after invoking Vim with xargs

This happens when vim is invoked and it's connected to the previous pipeline's output, instead of the terminal and it's receiving different unexpected input (like NULs). The same happens when you run: ...
user avatar
  • 16.6k
27 votes
Accepted

Prevent Vim from clearing the terminal after exit

By default VIM, when terminating, sends the string configured with the option t_te to the hosting terminal to tell it to clear the screen. To avoid it just :set t_te= to send nothing to the terminal ...
user avatar
  • 4,482
21 votes
Accepted

How to label tmux tabs with the name of the file edited in vim?

There you go : autocmd BufReadPost,FileReadPost,BufNewFile,BufEnter * call system("tmux rename-window 'vim | " . expand("%:t") . "'") Decomposing : autocmd BufReadPost,FileReadPost,BufNewFile,...
user avatar
  • 15.2k
21 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 ...
user avatar
  • 753
20 votes
Accepted

Tmux is changing part of the background in vim

You might try to add the following to your .vimrc. if &term =~ '256color' " disable Background Color Erase (BCE) set t_ut= endif The t_ut option (default = y) describes how vim handles what ...
user avatar
20 votes
Accepted

Scroll the screen, not the cursor, when using scrollwheel

As @Doorknob said in his comment, :set mouse=a fixes the problem.
user avatar
  • 1,037
19 votes

How to map Alt key?

With help of Carpetsmoker, it seems that Terminal wasn't configured to 'Use Alt/option as meta key' (this is especially common for GUI Terminals). For Terminal on OSX, it's in Preferences -> ...
user avatar
  • 16.6k
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/...
user avatar
  • 1,326
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 ...
user avatar
13 votes

Terminal borked after invoking Vim with xargs

Workaround suggestion: use a buffer as a filesystem navigator Use the vim - command to read a list of paths from stdin. Vim's :help -- explains this:1 Start editing a new buffer, which is filled ...
user avatar
  • 5,806
13 votes
Accepted

Number pad not working with vi and Putty?

Your terminal (PuTTY) is configured to send escape sequences for keypad keys, rather than digits. This is called “application keypad mode” in Unix terminal terminology. You can configure Vim to ...
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' ...
user avatar
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 ...
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'"
user avatar
  • 32.8k
12 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 ...
user avatar
11 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: ...
user avatar
  • 262
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 ...
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 ...
user avatar
  • 276
11 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 $...
user avatar
  • 643
11 votes
Accepted

Opening :terminal window in new buffer

Thanks to Christian Brabandt, :ter ++curwin was the thing that I want.
user avatar
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) ...
user avatar
  • 5,898
11 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 ...
user avatar
  • 25.8k
10 votes

Colorscheme's background not correct in terminal

There's two reasons why I think this may be happening: The solarized color scheme you are using does not declare ctermfg and ctermbg for any of the features you want to highlight. Try out this color ...
user avatar
10 votes
Accepted

Mapping Ctrl+s does not work

To ensure that this workaround runs even when Vim is started by a separate tool (such as git), I have this in my ~/.vimrc: " Allow us to use Ctrl-s and Ctrl-q as keybinds silent !stty -ixon &...
user avatar
  • 3,412
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 :...
user avatar
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: +----+----+...
user avatar

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