2

I am working on removing comments from a C source file. Let's focus on multiline comments /* ... */ and ignore the inline ones (//)

The following command seems to work with (solaris) sed:

s:/\*.*\*/::g

However in Vim (7.2) it only works if the whole comment is on one line. How can I make it so the .* spreads over multiple lines? I tried doing the follwing

s:/\*.*[\r]*.*\*/::g

but it didn't work ...

4

I believe you'd want

s:/\*\_.*\*/::g

\_ tells it to include newlines in the following character set (well, ., anyway).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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