Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [escape]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
29 views

Special characters, escaped special characters, escape sequences, and terminal codes

I refer to those 4 terms using terminology picked up by various sources: Steve Losh, in his Learn Vimscript the Hard Way's chapter 16 refers to things like <cr> (these 4 characters typed in a ...
user avatar
  • 1,572
0 votes
1 answer
31 views

How to change [esc] behavior only in normal mode?

I'm hoping I phrased the question correctly as I'm not too sure how to ask my question. When I work in vim I use multiple "splits" (eg. :vsp, :sp). To navigate through the splits I have it ...
user avatar
1 vote
1 answer
24 views

Command to go to Normal-mode and Visual-mode (or exiting insert-mode) - pressing ESC without the escape-key

I'm working on a server, that I can only SSH into via a browser. In there, I have to edit some files. The problem is, that let's say I go to INSERT MODE and write some text. If I then want to go back ...
user avatar
  • 365
0 votes
1 answer
64 views

How to escape a pipe (|) in my vimrc

I've seen How to escape pipe character in `:make`, `:grep` and friends How to escape pipe (|) in mapped substitution? https://stackoverflow.com/questions/29596150/use-to-diplay-tabs-in-vim But none ...
user avatar
1 vote
1 answer
106 views

Replace two forward slashes with one using escape? [duplicate]

I am new to VI. How do you replace two forward slashes with one globally? I did: :%s/\// and :%/\//\/g Those don't work as desired. Example or Goal //This is good//because it//works; //on every//...
user avatar
  • 13
1 vote
1 answer
55 views

Escaping ' (apostrophe) in \\' (leader leader apostrophe) in a @let statement inside .vimrc

I have mapping \\' (leader leader apostrophe) within my .vimrc. The mapping works just fine. I have recorded a macro to key e using this mapping. qe ... steps ... q The macro works just fine. then I ...
user avatar
  • 531
8 votes
3 answers
1k views

See what Vim `:!` executes

Between :%! exe "!..." exe "!bash -c" shellescape(...) I'm getting quite confused as to what exactly Vim invokes. And I suspect at some point it invokes bash -c bash .... Is ...
user avatar
  • 325
0 votes
1 answer
82 views

Mapping jj to Escape doesn‘t work over SSH connection

When I connect to a remote server via iterm2 and SSH and use vim on this server remapping to the Escape key doesn't work. Other key mappings in the .vimrc work as expected but inoremap jj <Esc> ...
user avatar
  • 125
0 votes
0 answers
29 views

Attaching audio spoken word "escape" to Esc key stops escape key escaping to normal mode in nvim. How to fix?

I am running the latest versions of: Arch, nvim, and the Openbox window manager. I often don't know whether I have actually hit the escape key or not, when exiting another mode to normal mode. If I ...
user avatar
  • 531
0 votes
1 answer
82 views

escape sequences showing up within vi

When I am working in vi there pop up things that look like uninterpreted escape sequences. They come for example when I type i to enter insert mode, or ESC to leave it Example, triggered by typing i ...
user avatar
0 votes
2 answers
124 views

Adding <Esc> to a remap literally inserts <Esc> into the file

I'm remapping o and O in my Git Bash vimrc to insert a new line without staying in insert mode: nnoremap o o<Esc> nnoremap O O<Esc> The problem is that a new line is inserted and the ...
user avatar
  • 103
2 votes
1 answer
385 views

Replace embeded escape code in text

I am using the most recent nvim in arch. I have this text showing in my text doc customerâ<80><99>s the <80><99> appears in blue. The text should read customer's I wish to ...
user avatar
  • 531
0 votes
1 answer
148 views

Escape for double quotes not working

I'm trying to search for quotation mark, but it seems it doesn't work: \v^\s"\zs\"+ is what i tried. Though I'm well aware it need to be escaped...I tried: \v^\s""\zs\""+...
user avatar
9 votes
1 answer
232 views

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

Here is the list of experiments I performed that shows that <Bar> is treated as literal <Bar> in some commands but it is treated as | in the :command command. I am trying to understand why ...
user avatar
4 votes
0 answers
192 views

How to exit insert mode if pressing escape merely types "^["?

I have neovim 0.4.2 running in a session of kiTTY 0.17.4 on OSX. I have pasted a long url while in insert mode. After doing this, every time I type BKSPC vim adds ^? to my document. Every time I type ...
user avatar
4 votes
1 answer
476 views

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

If you have an American English keyboard, pressing Ctrl-[ (control plus left square bracket) is equivalent to pressing Esc. This provides an easy way to exit from insert mode. source: https://vim....
user avatar
1 vote
2 answers
405 views

Problem remapping § to esc in vim on a macbook with touch-bar

I am using a macbook with touchbar. As many others I would like to map a different key to the esc key, since the touchbar esc is a bit inconvenient. My problem is that I have some weird behaviour of ...
user avatar
2 votes
1 answer
165 views

escape, ctrl-w through citrix lite in browser

I need to be able to run vi on a machine that I access through Citrix lite in the browser. However I've come across a number of problems because of conflicts around esc and ctrl+w. Specifically, ...
user avatar
1 vote
1 answer
2k views

Search for Pattern "^M*"

My file contains multiple blocks looking like this some Test "^M ^M ^M "some more text I'd like to remove these passages (including the "), but can't seem to fine the right regex. EDIT: I already ...
user avatar
0 votes
1 answer
908 views

How can one use jk to escape universally without causing hang?

Recently I was reading http://learnvimscriptthehardway.stevelosh.com, and he said a very fast way to improve your speed in vim is to do inoremap jk <esc>. Sure, that made sense. Then when I ...
user avatar
  • 169
1 vote
1 answer
108 views

How to remap escape in *vi* (not vim)?

I've used the information in this answer previously, but recently encountered a minimal installation with only vi. I edited the .vimrc in the user's home folder (~/.vimrc), but when typing jj, the ...
user avatar
3 votes
1 answer
94 views

Is ESC involved in any key combinations?

Just starting to get into Vim and facing the classic escape problem. I'm thinking binding CapsLock to be control when used with another key, and escape when released without pressing anything else ...
user avatar
  • 391
1 vote
0 answers
166 views

Pressing <Alt-3> (left alt key) suddenly maps to Esc (and not the character "#") using iTerm2 [closed]

Characteristics: MacOS 10.14.6 I'm using VIM as text editor for a few weeks, with both Terminal and iTerm2 I could write character dependent on hitting key alt (left alt key in iTerm) without ...
user avatar
  • 139
3 votes
1 answer
74 views

Match <Esc> only for the ESC key, not escape sequences

In a normal mode key mapping I'd like to match the ESC and only this key, not key sequences like caused by the arrow keys. Background: I thought I'd torture myself in the process of avoiding excess ...
user avatar
2 votes
1 answer
1k views

How to escape forward slashes?

I was editing a file and found accidentally that I somehow escaped all the forward slashes in a path I was replacing in text. And that is something very useful! For instance, to do this replacement ...
user avatar
  • 21
2 votes
1 answer
196 views

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

Here is a Python list that I'm trying to assign to some Vim variable. lines = ['"""Something foo\'s thing."""', '', 'foo = "asdfasdf" \\', 'bar'] command = 'let l:corrected_lines = {lines}'.format(...
user avatar
1 vote
3 answers
268 views

Command to copy from current window and paste the text into terminal buffer

I am having trouble crafting a command that would copy the text from the current window and paste this text into a terminal buffer opened in the split below. Here are a few things I tried: normal ...
user avatar
0 votes
0 answers
145 views

How to stop a function when <esc> is pressed? OR how to catch a <esc> signal in vimscript?

I have a function which calls another function that reads user input from input(). function! fun1() call fun2() endfunction function! fun2() let temp = input("Please input:") endfunction What I ...
user avatar
  • 109
1 vote
1 answer
240 views

Can you match unicode blocks by name in vim?

\p{Cyrillic} Works in my normal regular expressions. When trying to match in Vim or gvim however, I can not seem to get it to work. I tried something like this: \p\{Cyrillic} Is it not supported, ...
user avatar
  • 825
1 vote
1 answer
310 views

fnameescape() : add other characters to be escaped (parenthesis, commas etc)

I looked around for a long time but did not find any solution for that. On my Unix system (Ubuntu), using LaTeX-suite, I need to escape some characters in file names for compilation, say parenthesis (,...
user avatar
  • 11
3 votes
1 answer
607 views

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

Foreword I use UltiSnips and have the following definitions in my .vimrc file let g:UltiSnipsExpandTrigger="<F8>" let g:UltiSnipsJumpForwardTrigger="<F8>" let g:...
user avatar
  • 1,572
2 votes
1 answer
120 views

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

I've started using CTRL+C instead of ESC in vim because of its position on the keyboard and better responsiveness. It mostly behaves the same except when exiting visual block replacements. I am ...
user avatar
  • 243
1 vote
1 answer
44 views

Going to the start of insert command on exit

Hi Vi StackExchange, A Picture of what I want Say I have the following in my buffer: foo("a", "bar") And I am in normal mode with my point on b in bar. Now I want to insert some ...
user avatar
13 votes
5 answers
11k views

Slow vim escape from insert mode

When I press <Esc> from insert mode, it delayed about 1 sec, but if I just do <ctrl+c> instead it is fast. I checked if there were mapping with escape with :verbose imap <Esc>, but ...
user avatar
7 votes
1 answer
5k views

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

If I run cat under terminal (xterm-256color), and then press the up arrow button, I see ^[[A as output. But if I press <ctrl-v> <up> in vim insert mode, I see ^[OA as output. So i wonder ...
user avatar
  • 173
-1 votes
1 answer
106 views

Is \r operating system specific?

In the Vim documentation, it says that \r "matches < CR >", however for the result of replacement I could not find in the documentation a description of what it does. For example, imagine this: :%...
user avatar
  • 1,825
1 vote
2 answers
119 views

Avoid so much escaping in substitution expression

I have a substitute expression to find words beginning with a dollar signs and capture them like this: :%s/\$\(.*\)\>//g However there are a lot of escape sequences in the regular expression (4). ...
user avatar
  • 1,825
3 votes
1 answer
463 views

endif treated as part of command in autocmd

Here is my code: autocmd BufWritePost *.c,*.cpp,*.h \ let dir=expand('<amatch>:p:h') \ | if filereadable(dir.'/Makefile') || filereadable(dir.'/makefile') \ | Make > /dev/null \ |...
user avatar
  • 195
5 votes
1 answer
6k views

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

I'm trying to use :grep to search for one of several words. Since grep accepts regular expressions, I figured I could just use the pipe character | to build a single expression for both words: :grep -...
user avatar
  • 173
0 votes
1 answer
2k views

Exiting back to normal mode in terminal buffer from Vimscript

<C-\><C-n> is working as (I'd) exepected, but not from a Vimscript. I am trying to make a script that will: open Neovim's :terminal run a python script exit from the terminal input mode ...
user avatar
  • 440
1 vote
1 answer
858 views

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

If I open (vanilla) vim by running $ vim [-u NONE], switch to insert mode by pressing a, add an 'a' by pressing a again, switch back to normal mode by pressing ESC, and repeat steps 2 and 4 several ...
user avatar
  • 131
4 votes
1 answer
926 views

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

My question is related to this post which for some reason was closed. Here's my .vimrc file set cpoptions=BceFs$ ":compatibility flags with /usr/ucb/vi set hlsearch hi Search ctermfg=white ...
user avatar
  • 625
0 votes
1 answer
338 views

Ask a list of all percent-prefixed variables

In reading other's .vimrc, I find many percent signs. For instance in the portion concerning the status line, I know %F%m%r%h must stands for something like the current filename being edited. But ...
user avatar
3 votes
1 answer
309 views

How to escape filename containing single and double quotes mix?

Let's say i create a filename with this: xb@dnxb:/tmp/test$ touch '"i'"'"'m noob.mp4"' xb@dnxb:/tmp/test$ ls -1 "i'm noob.mp4" xb@dnxb:/tmp/test$ Then vim . to go inside Netrw directory listing. " ...
user avatar
  • 237
5 votes
1 answer
577 views

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

I've recently mapped jj to <ESC> in insert mode for quick escaping. While everything is functional, I find the brief delay after typing j while it waits for a second input very distracting. Is ...
user avatar
6 votes
3 answers
457 views

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

I cannot figure out how to open a file that starts with +, e.g. +models/File.m. This is a naming convention for packages in Matlab. I've tried escaping \+models/File.m. This doesn't work because the ...
user avatar
  • 163
4 votes
1 answer
79 views

Two character remap sometimes failing in INSERT mode

For 4-5 years I've had the following in my .vimrc file: inoremap jj <Esc> which I understand is pretty conventional, and I've never had problems until recently. Every so often, typically when ...
user avatar
7 votes
1 answer
1k views

How to escape angle brackets in mappings (the ones that appear in <esc> and <cr>)

I am making a complex mapping that requires me to insert angle brackets (<and >) but I do not know how to escape them so vim does not interpret them as special key-codes. It seems like escaping ...
user avatar
  • 1,023
4 votes
0 answers
448 views

How to remap <C-[> on linux [duplicate]

I have the same vimrc file for both Windows and Ubuntu environments. It works fine on both platforms, except for one difference. The line: nmap <C-[> <C-t> is working fine on Windows, ...
user avatar
9 votes
4 answers
6k views

How can I bind Ctrl-Space to be Esc when not in insert mode, and to switch to insert mode otherwise?

I dislike to have to reach up to the Escape key all the time. For a while I used the program xcape under Linux to map Caps lock to be both Control and Escape. However, I am currently working more and ...
user avatar