Vi(m) tip #3: convert document to lowercase or uppercase

Convert every matching regex (or line) to lowercase or uppercase using vims gsub command. In normal mode this will convert the entire document to lowercase (ie downcase all capitals):


Likewise for to upcase:



Tags: , , , , , ,

2 Responses to “Vi(m) tip #3: convert document to lowercase or uppercase”

  1. julien says:

    from the first line,
    to select all lines,
    “~” to invert the case if the whole file was in uppercase
    “veu” to downcase (“veU” to uppercase)

  2. Abel says:

    Julien’s method works great and it’s easier on the fingers :)

Leave a Reply