The number of adverbs I've just deleted from my novel! It doesn't seem like enough really. Vim is like magic and I've learnt a magic spell to delete all adverbs. It is consisely written out as
:%s/\s*[a-zA-Z]\{-}ly\([^a-zA-Z]\)/\1/g
And no, I don't know exactly how it works either. But you can see why it feels like magic?
(
Read more... )
Comments 8
:%s/\s*[a-zA-Z]\{-}ly\([^a-zA-Z]\)/\1/g
:%s/begin a substitution
\s*match 0 or more bits of whitespace
[a-zA-Z]\{-}match as few letters as you can while still matching the rest of the pattern
lymatch ly
\([^a-zA-Z]\)match something which isn't a letter, and remember it
/end the match, start the substitution.
\1put in the non-letter you remembered above
/end the substitution
gallow multiple replaces per line.
Reply
I can't think of an easy way to provide a list of words to not match (e.g. family), as the only realy approach that comes to my mind would be branch + abort, but I do not believe vim regexps support aborts...
Reply
Reply
At that moment a man swung through the window, the shards of glass barely hitting the floor before the intruder's fist connected with the butler's chin causing the servant to crumple to the floor.
"Terribly sorry about the mess, but he was a nazi, you know."
The man doffed his battered hat to the astonished girl before leaping back out through the window, grabbing the rope he came in by and expertly rappelling to the ground.
Reply
Reply
Reply
Reply
Reply
Leave a comment