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.

Using gVIM on XP

How can I convert the left side of this file to lowercase while keeping right side unchanged?

%s/**what goes here?**/g

CONVERTTOLOWERCASE###Keep CaSe
AAAA###AeiOu
BBBB###qWerTy

Desired Results

converttolowercase###Keep CaSe
aaaa###AeiOu
bbbb###qWerTy
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Here is the command you are looking for:

%s/^[^#]\+/\=toupper(submatch(0))/

See:

  • :help tolower()
  • :help sub-replace-special
  • :help sub-replace-expression
  • :help submatch()
share|improve this answer
add comment

Your Answer

 
discard

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.