3

I recorded a macro, that has an enter in it ggd/{<CR>Gdd but of course is ^M. What I want to do is run this on a bunch of files from the commandline which I guess would be something like

ex +"normal ggd/{<CR>Gdd" +wq

but how do I put an actual enter where it should go?

1 Answer 1

3

Try

ex +"exe \"normal! ggd/{\<CR>\"" +"normal! Gdd" +"wq"

Basically you need to use :execute where you can pass \<CR> inside a double-quoted string

UPD as suggested in comments:

ex +'exe "normal! ggd/{\<CR>"' +'$d' +wq
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.