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

Slow vim escape from insert mode

It is mentioned in direct comments below the question itself. But just in case: If you use tmux you may need to tweak escape-time. See explanation here and solution here. .tmux.conf set -g escape-time ...
Pirastrino's user avatar
23 votes

Slow vim escape from insert mode

There are two kinds of delay when you press <esc> in insert mode: mapping delay If you create some improper mapping that starts with <esc> : inoremap <esc>x <esc>:echom "...
dedowsdi's user avatar
  • 6,268
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
10 votes
Accepted

See what Vim `:!` executes

When you use ! or :! Vim builds the invoking command based on whatever is specified in the various 'shell...' settings (i.e. 'shell', 'shellcmdflag', 'shellquote', to name three). On Unix systems the ...
B Layer's user avatar
  • 19.9k
9 votes

Other ways to exit Insert mode besides Escape

I would suggest using my plugin vim-easyescape. Plug "zhou13/vim-easyescape" let g:easyescape_chars = { "j": 1, "k": 1 } let g:easyescape_timeout = 100 cnoremap jk <ESC> cnoremap kj <ESC> ...
Yichao Zhou's user avatar
9 votes

How to escape forward slashes?

You don't need to escape them: you could use a different separator for the search pattern and the replace part: %s;mvn;/opt/maven/bin/mvn;g But, if you really want to escape them, you can use a ...
João A. Toledo's user avatar
9 votes
Accepted

How to remove the mapping from Ctrl-[ to Escape?

Vim is a terminal based program and has its key handling from the terminal. Also the GUI variants still act like this (with a few extensions). In a terminal Ctrl-A is ASCII 0x01, Ctrl-B is ASCII 0x02 ...
Ralf's user avatar
  • 9,247
8 votes

Slow vim escape from insert mode

You could try set noesckeys. Here are its docs: Function keys that start with an <Esc> are recognized in Insert mode. When this option is off, the cursor and function keys cannot be used in ...
Andy Stewart's user avatar
  • 1,359
8 votes

See what Vim `:!` executes

Is there a way to see exactly what shell command is being called out? To see what exactly is run, :echo getpid() will show vim's PID, e.g. 1234, with which you can then in another terminal run: sudo ...
JoL's user avatar
  • 570
7 votes

Other ways to exit Insert mode besides Escape

You can map Caps Lock to Control without installing any extra software: In Mac OS X visit System Preferences > Keyboard -> Modifier Keys In Linux execute: setxkbmap -option caps:ctrl_modifier ...
joeytwiddle's user avatar
  • 3,642
7 votes

Search for Pattern "^M*"

Characters displayed by ^ followed by a capital letter (or a small number of other symbols, such as ^[) are the usual notation for the ASCII character produced by pressing that letter while holding ...
filbranden's user avatar
  • 28.9k
6 votes
Accepted

Is it possible to open a new file that starts with '+'?

From vim --help: Arguments: -- Only file names after this ... So this works on the command line: vim -- +models/File.m From inside Vim you need to escape the +: :e \+models/...
Sato Katsura's user avatar
  • 4,009
6 votes
Accepted

Some function keys switch cases of letters under and after the cursor

The codes which keys produce varies wildly by terminal. vim tries to guess which escape sequences corresponds to which keycodes (<f1> etc) based on the $TERM variable and terminfo. The shifted ...
Mass's user avatar
  • 14.1k
5 votes
Accepted

recover default behavior of arrow keys rather than having them produce ABCD, when I map <esc>

I'm not sure of the solution (or if there is one) but I can explain roughly what's causing the problem to occur. When you press an arrow key on your keyboard, what your terminal actually passes to ...
Rich's user avatar
  • 32.1k
5 votes
Accepted

How to escape pipe character in `:make`, `:grep` and friends

As stated on the question, :h map-bar suggests escaping the pipe with with \|. However, grep apparently understands that as a literal bar, thus the backslash needs to be escaped as well. This should ...
lsrdg's user avatar
  • 460
5 votes
Accepted

Why does ^C behave differently from ESC when exiting visual block substitution?

At first they might do the same but internally they are interpreted differently. In layman's terms they mean something like this: Esc: "OK I am done (with whatever I was doing)." CTRLC: "Stop that ...
Lucas's user avatar
  • 1,629
5 votes
Accepted

Can you match unicode blocks by name in vim?

Vim has its own regex engine and it doesn't support {Cyrillic}. You probably want to read :h pattern-atoms and :h /character-classes to find out what you can use in your regexes. I think the best ...
statox's user avatar
  • 50k
5 votes
Accepted

Replace two forward slashes with one using escape?

The command you are trying to use is the following: %s/\/\//\//g % The range: All lines in buffer s the substitution command / / / the separators of the substitution ...
statox's user avatar
  • 50k
4 votes

Is \r operating system specific?

No, that is not true. Internally, \n will always match the line termination of a buffer regardless of whether the actual file uses <CR> or <NL> or <CR><NL> as line terminator (...
Christian Brabandt's user avatar
4 votes
Accepted

How to assign a Python list to a vim variable and escape its strings correctly

Use pyeval(), py3eval(), or pyxeval() to read python variables into vim: python: x = [1,2,3] vim.command('let X = pyeval("x")') vim: py x = [1,2,3] let X = pyeval('x')
Mass's user avatar
  • 14.1k
4 votes
Accepted

Why does `<Bar>` behave like `|` in the `:command` command in Vim?

So I went digging for this one and as far as I can tell this behavior has been present ever since the user-defined command feature was introduced in Vim 5.2. Initially I thought this was present ...
filbranden's user avatar
  • 28.9k
4 votes

See what Vim `:!` executes

An easy check is :!foo that (probably) will print something like bash: line 1: foo: command not found. Also see :h job_start() (or :h jobstart() for Neovim) and so on. To summarize: :! always uses &...
Matt's user avatar
  • 20.8k
4 votes
Accepted

How to escape a pipe (|) in my vimrc

Read :h 'lcs': "Two or three characters to be used to show a tab". First, the first one. Then the second one repeated as many times as needed. set lcs=tab:\|\|
Matt's user avatar
  • 20.8k
3 votes
Accepted

endif treated as part of command in autocmd

If the :Make command you are using is this one, then your issue may come from the fact that it was not given the -bar attribute when it was defined. See :h :command-bar: -bar The command can ...
user852573's user avatar
  • 1,023
3 votes
Accepted

delay between hitting `ESC` (in insert mode) and switching to normal mode within `screen`

I found the solution on http://vim.wikia.com/wiki/GNU_Screen_integration: Getting the Esc key to work If you use Vim under Screen, you might find that the Esc key doesn't work. To fix ...
mschilli's user avatar
  • 161
3 votes
Accepted

Ask a list of all percent-prefixed variables

If it is from statusline, then :h statusline is what you need. Vim has help for every single variable that you can set in .vimrc (at least the ones that come with pure Vim, plugins usually also have ...
grodzik's user avatar
  • 4,638
3 votes
Accepted

How to escape filename containing single and double quotes mix?

I got the answer from Unix & Linux Stack Exchange, backslash-escape literally every character: nnoremap <C-c> :!eval `ssh-agent -s`; ssh-add; rsync -azvb --no-t %:gs/./\\&/:p 'xiaobai@...
林果皞's user avatar
  • 237
3 votes

How do I prevent the delay when mapping jj to <ESC> in insert mode?

Add <nowait> to map command, which will prevent this delay. It will instantly leave insert mode as soon as the second j is pressed, as well as remove initially typed j. Also if you need to type ...
otter.pro's user avatar
  • 508
3 votes

Is it possible to open a new file that starts with '+'?

More generally, you can start by specifying a directory name, so that the + (plus sign) appears in the middle of the file specification instead of at the beginning. Because all *nix operating systems,...
Eli Skolas's user avatar
3 votes

Other ways to exit Insert mode besides Escape

FWIW I use: :map! ;l ^[ :vmap ;l ^[ It feels similar to hitting Return. I use ; as the leader for other Insert-mode mappings too. The only time I've needed to type ';' + letter is when code ...
Antony's user avatar
  • 2,580

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