I have a list of regular expressions that I would like to run in my C code files. This is simple formatting material and will save me the trouble until my code is reviewed.
Here they are
this removes two or more blank lines in one blank line
:%s/\n\{3,}/\r\r/e
this adds the missing space at the end of the comment, e.g. / * blah blah * / to / * blah blah * /
:%s/\([^ *]\)\*\//\1 \*\//gc
this adds the missing space at the beginning of the comment, e.g. / blah blah / to / * blah blah * / Note that it ignores / **
:%s/\/\*\([^ *]\)/\/\* \1/gc
removes empty lines after opening the bracket {
:%s/{\s*$\n\{2,}/{\r/gc
removes empty lines before closing the bracket}
:%s/\n\{2,}\(\s*\)}/\r\1}/gc
in the comments, a space after the decimal point is added if there are no TODO hints and error E16 if no patterns match
:g/\/\*/ ,/\*\// s/,\([^ ]\)/, \1/gc
I saved them in a file called fix.txt. Is there a way that I can run them from within VI one by one? something like
:run fix.txt ?
user636273
source share