- Half the even numbered spaces
:% s/\(\( \)\{\-2\}\)/\2/g
by matching the the consecutive 4 spaces, source- origin:
s/(( ){-2}/$2/g
- origin:
- Half the even numbered spaces
:% s/\^\(\( \)\+\)\\1/\1/g
by matching the whole spaces and halving them, source- origin:
s/^(( )+)\1/$1/g
- origin:
- Encapsulate all the small caps strings into double quotes:
:% s/\([a-z]\+\)/"\1"/g
- origin:
s /([a-z]+)/"$1"/g
- origin:
- Replace
[:abc]
with"abc"
::% s/\[:\([a-z]\+\)\]/"\1"/g
- origin:
s /[:([a-z]+)]/$1/g
ors /\[:([a-z]+)\]/$1/g
I have to double check
- origin:
- Replace
Model.enum[:abc].to_s
with"abc"
::% s/Model\.[a-z]\+\[:\([a-z]\+\)\]\.to_s/"\1"/g
- origin:
s /Model\.[a-z]+[:([a-z]+)]\.to_s/$1/g
ors /Model\.[a-z]+\[:([a-z]+)\]\.to_s/$1/g
I have to double check
- origin:
- Remove trailing spaces:
:% s/\s\+$//g
- origin
s/\s+$//g
- NOTE: to keep tabs and other whitespace chars, use
:% s/[ ]\+$//g
- origin
- The variable grouping takes place through an escaped
()
- However letter bags take place through non-escaped
[]
- Using escaped
\[\]
will match the brackets exactly