Here’s a sneak peek at my upcoming book named “Technical editing with Vim substitutions”, which shows removing trailing periods from markdown lists:

:%s/\(\(-\|*\|\d*\.\) .\+\)./\1/

Actually, that substitution removes the last character from each list item in the file instead of just periods. 🤷‍♀️

Remember; don’t forget to `\` your `.`’s!

Are you just getting started with Vim-substitution-based editing? Don’t worry; the book has your back! This absolute classic is the first substitution I always reach for first. Never remove trailing whitespace manually again!

:%s/ \+\n/\r/

@microbeta Since the document I'm editing only uses lists with dashes, `%s/\(- .\+\)\./\1/g` would have worked as well, but I'm a sucker for over-the-top unreadable Vim substitutions. ;)

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!