Monday, June 18, 2007

Vim Backreferences

%s/\(\d\d:\d\d:\d\d\)'/\1/
this will remove single trailing quote from the end of time portion of timestamp.


%s/\(\.\)\(\w\+$\)/\t\2/
will change
com.epictide.upmc.service.impl.AlertByUserSummaryServiceImp
at end of line to
com.epictide.upmc.service.impl AlertByUserSummaryServiceImp
with a tab between the package and the class.



# convert camel case to DB table name format.
# put an underscore between each lower case followed by upper case character.
:%s/\([a-z]\)\([A-Z]\)/\1_\2/g

# make all character upper case
:%s/.*/\L&/g

No comments: