Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

escape character in vim command

Tags:

linux

shell

vim

I want to run command like this:

vim -c "%g/blablabla/norm /str<ESC>cwSTR" file

How I write escape character in the command?

like image 318
dimba Avatar asked Nov 05 '09 07:11

dimba


People also ask

How do I escape a character in Vim?

As you type the command, use control-v then escape to enter the escape.

How do you escape a char?

Escape CharactersUse the backslash character to escape a single character or symbol. Only the character immediately following the backslash is escaped. Note: If you use braces to escape an individual character within a word, the character is escaped, but the word is broken into three tokens.

How do I type special characters in Vim?

While in insert mode, you can insert special characters in Vim by pressing <ctrl-k> followed by a two-character lookup code. For example, <ctrl-k> ? 2 will insert the approximately equal symbol: ≈ .

How do you escape a character in terminal?

Escape characters. Escape characters are used to remove the special meaning from a single character. A non-quoted backslash, \, is used as an escape character in Bash. It preserves the literal value of the next character that follows, with the exception of newline.


1 Answers

As you type the command, use control-v then escape to enter the escape.

However, I have to question whether vim is the right tool for this job. Normally, you would be better off with something like sed. That said, I'm not quite clear what the vim command is up to, so maybe you do need it.

like image 115
Jonathan Leffler Avatar answered Sep 23 '22 05:09

Jonathan Leffler