dimba
dimba

Reputation: 27641

escape character in vim command

I want to run command like this:

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

How I write escape character in the command?

Upvotes: 9

Views: 11789

Answers (2)

haridsv
haridsv

Reputation: 9693

This is what I would do:

vim -s -c ':exec "normal %g/blablabla/norm /str\<Esc>cwSTR"' file

Notice that I am using :exec to expand the "\" to the real . The advantage? it is more script friendly. However, I am not sure what this command is doing, are you using some of your custom maps here?

Upvotes: 0

Jonathan Leffler
Jonathan Leffler

Reputation: 755064

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.

Upvotes: 16

Related Questions