Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Found this site:

And it works for the first character but my lines are line this


And I would like this


Any thoughts?

VI Command would be nice but any other simple solution would work as well

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

do :%s/^./\U&/ then :%s/_./\U&/g

the first will uppercase the first letter of every line, the second will uppercase the first letter after each underscore in all lines.

share|improve this answer
Thanks! Perfect –  Phill Pafford Feb 16 '12 at 19:01
add comment

Combining the two search/replace Rob suggested:


will search for either the first char in a line or the first char following an _

'or' is specified by \|

the 'g' will change all occurrences in a line

the 'c' will ask for confirmation


share|improve this answer
Thanks, I never knew how to combine them! Useful info! –  Rob Feb 22 '12 at 15:10
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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