Menu

Christian Stryczynski

Freelance software developer. Haskelling at night. Hopefully unconventional. Fan of Dvorak

My Vim Fu

Vim Regex Fu

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 ; }
  }


Written by Christian Stryczynski on Sunday April 23, 2017

Permalink -

« Going freelance fulltime! - Haskell learning resources »