开发者

escape character in vim command

开发者 https://www.devze.com 2022-12-10 02:46 出处:网络
I want to run command like this: vim -c \"%g/blablabla/norm /str<ESC>cwSTR\" file How I write escape charact开发者_Python百科er in the command?As you type the command, use control-v then esca

I want to run command like this:

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

How I write escape charact开发者_Python百科er in the command?


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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消