Questions tagged [escape]

The tag has no usage guidance.

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

Can I map Alt+j without mapping Escape followed by j to the same thing?

If in insert mode I do Ctrl+v and then press Alt+j, I see ^[j inserted, with ^[ being actually a single character. That's the same I get if I press Escape followed by j instead of Alt+j. I've known ...
Enlico's user avatar
  • 2,184
1 vote
1 answer
84 views

What are the escaping rules of command arguments?

The following does nothing: :file /tmp/[some file] or: :file "/tmp/[some file]" The following set's the file to /tmp/[some file]: :file /tmp/\[some file] What are the rules that :file ...
KamilCuk's user avatar
  • 265
1 vote
1 answer
83 views

How to replace <Esc> with Ctrl-c completely?

NVIM v0.9.1 Windows10 I usually prefer <C-c> rather than <Esc> or <C-[> which made me think that I want to replace <Esc> with <C-c> perfectly for almost all situations(...
keisuke murota's user avatar
1 vote
1 answer
88 views

Why very magic flag can't take effect on character = in substitute command?

We can see the explaination on very magic :With very magic, all ASCII characters except 0…9, a…z, A…Z and _ become a a special meaning. In this mode, searching for text becomes very magic. When you ...
showkey's user avatar
  • 1,120
1 vote
1 answer
33 views

Why rhs of cnoremap (used as a rhs of another cnoremap) can be <c-s> but not <space>?

If you execute this cnoremap <expr> <silent> <C-S> execute(':cnoremap <c-s> ctrl-s') and then hit /Ctrl-sCtrl-sCtrl-sCtrl-s, you'll see the search command be populated by /...
Enlico's user avatar
  • 2,184
1 vote
2 answers
40 views

lnoremap doesn't seem to apply to insert mode when mapping an unwanted key combo to nop

This is a follow up to this question of mine. I found out that having :noremap ^[[29^ <Nop> in my vimrc is not enough to disable the unwanted effect of Ctrl+Menu in insert mode, so I looked at :...
Enlico's user avatar
  • 2,184
2 votes
1 answer
146 views

How can I inhibit the effect of hitting Ctrl+Menu

I'm referring to holding Ctrl and hitting Menu (which is this key), which happens by mistake sometimes. For me it results in going back to normal mode and moving to the first non-blank character of ...
Enlico's user avatar
  • 2,184
1 vote
1 answer
560 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 ...
Enlico's user avatar
  • 2,184
0 votes
1 answer
57 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 ...
hermancain's user avatar
1 vote
1 answer
886 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 ...
Zeth's user avatar
  • 395
0 votes
1 answer
134 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 ...
Siddharth Shyniben's user avatar
1 vote
1 answer
534 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//...
Kenny's user avatar
  • 13
1 vote
1 answer
272 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 ...
Kes's user avatar
  • 641
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 ...
usretc's user avatar
  • 375
0 votes
1 answer
190 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> ...
Mountain's user avatar
  • 125
0 votes
0 answers
37 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 ...
Kes's user avatar
  • 641
1 vote
2 answers
774 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 ...
Karel Adams's user avatar
0 votes
2 answers
142 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 ...
Harith's user avatar
  • 103
2 votes
1 answer
1k 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 ...
Kes's user avatar
  • 641
0 votes
1 answer
671 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\""+...
Nordine Lotfi's user avatar
11 votes
1 answer
411 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 ...
Lone Learner's user avatar
6 votes
2 answers
740 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 ...
Andrew Farrell's user avatar
4 votes
1 answer
1k 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....
Steven Roose's user avatar
1 vote
2 answers
528 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 ...
Mr.Sh4nnon's user avatar
2 votes
1 answer
287 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, ...
technicguy1's user avatar
2 votes
1 answer
3k 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 ...
user7802048's user avatar
0 votes
1 answer
2k 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 ...
herophant's user avatar
  • 179
1 vote
1 answer
295 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 ...
user3.1415927's user avatar
3 votes
1 answer
109 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 ...
Mason's user avatar
  • 511
1 vote
0 answers
220 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 ...
ecjb's user avatar
  • 149
3 votes
1 answer
120 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 ...
try-catch-finally's user avatar
2 votes
1 answer
2k 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 ...
janux's user avatar
  • 21
2 votes
1 answer
286 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(...
ColinKennedy's user avatar
1 vote
3 answers
351 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 ...
Karolis Koncevičius's user avatar
0 votes
0 answers
187 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 ...
X.Arthur's user avatar
  • 109
1 vote
1 answer
355 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, ...
Anon's user avatar
  • 885
2 votes
1 answer
524 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 (,...
LLD's user avatar
  • 21
3 votes
1 answer
765 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:...
Enlico's user avatar
  • 2,184
2 votes
1 answer
125 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 ...
Lombard's user avatar
  • 263
1 vote
1 answer
45 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 ...
Jessie's user avatar
  • 113
26 votes
5 answers
17k 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 ...
user1946989's user avatar
9 votes
1 answer
7k 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 ...
jayven's user avatar
  • 193
-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: :%...
Tyler Durden's user avatar
  • 2,091
1 vote
2 answers
178 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). ...
Tyler Durden's user avatar
  • 2,091
3 votes
1 answer
517 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 \ |...
nalzok's 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 -...
wrtlprnft's 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 ...
lsrdg's user avatar
  • 450
3 votes
1 answer
1k 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 ...
mschilli's user avatar
  • 161
4 votes
1 answer
986 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 ...
Leo Simon's user avatar
  • 715
0 votes
1 answer
416 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 ...
Violapterin's user avatar