Chris Stryczynski

Software Developer / Consultant

My Vim Fu Regex

Change letter to upper case after each dollar sign (useful for PHP / Perl / Shell variable): s/\$\(.\)/\$\U\1/g

Input: $abcXyzYolo Output: $AbcXyzYolo


Replace every } with ; } if it does NOT (have a ; and some possible white space before it OR it has only white space characters before), this uses a look behind:

%s/\(.*;\s*\|^\s*\)\@<!}/; }/g


Input:

example { abcxyz }
example2 { abcxyz ; }
   }

Output:

example { abcxyz ; }
example2 { abcxyz ; }
  }