plv

3092

Jan 19, 2010 11:37

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... )

Leave a comment

Comments 8

cwoac January 19 2010, 13:02:50 UTC

:%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

cwoac January 19 2010, 13:08:05 UTC
You could shorten it slightly using [[:alpha:]] instead of [a-zA-Z]. Also, you could replace the [a-zA-Z]\{-} with [a-zA-Z][a-zA-Z]\{-} to avoid matching the non-word 'ly'
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

plv January 19 2010, 15:05:08 UTC
Wow thanks for explaining!

Reply


cwoac January 19 2010, 13:16:00 UTC
oh, and as for the women, well you know my response, and it involves:

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

plv January 19 2010, 15:06:03 UTC
That makes no sense whatsoever unless you explain that you intend to come to the group and read literary fiction which ends with that pulpy ending, just to confuse the English Teacher.

Reply

cwoac January 19 2010, 15:15:31 UTC
Don't forget the subtle use of adverbs to distinguish between what is real and merely the lucid dreams of the protagonist.

Reply


an_upsilamba January 19 2010, 20:21:59 UTC
bleh, that person sounds like a control freak! as a teacher, she's probably used to being in charge of a class of people less knowledgable than herself and can't let go of the urge to CONTROL. maybe there's a way you can get the message accross that a writing group is not the same as a class. also, i have little clue as to what an adverb is, which is somewhat shaming...

Reply

plv January 22 2010, 19:50:36 UTC
Heh, I've been reading lots of grammar books, which is the only reason I know. It's a word that describes how a verb is done, like quietly, softly, violently, and it's usually better writing to change to a stronger verb. Ie 'he plonked the cup down' or 'he slammed the cup down' is better than, 'he put the cup down carelessly' or 'he put the cup down violently'.

Reply


Leave a comment

Up