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?
精彩评论