This is a challenge that's only hard if you don't know the right command. If you do know the right command, it's trivial.
:se tw=999^MgqGZZ for 16.
The email quotes (
> at the front of the line) look like they'll get in the way, but
gq is can handle comment text. Just crank
textwidth up to 999 (or 298 if you're a minimalist), and you can finish the challenge with one command.
Too easy? Let's change the rules. What score can you get without
gq (or its less popular cousin
gw)? I can get 18:
This solution uses the regex
\n\A*\ze\l to match the newline and non-letters before a lowercase letter, but not the lowercase letter itself.
\ze forces the regex to match the text that comes after it, without it being part of the match to be replaced. It's often simpler and cheaper than using submatches.
Read the manual
:help gqis mostly irrelevant and confusing, but here it is.
gwdoes almost exactly the same thing, but no one likes it for some reason.
:help 'textwidth'will tell you little you didn't already know.
:help fo-tablehas interesting information about how to customize text formatting with
:set formatoptions. Not sure you'll get any use out of it though.
:help /character-classesis a VimGolfer's best friend.
:help /\zsfor more on
\zein regexes. They don't show up all that often in VimGolf, but they're a quick, intuitive way to get things done.
- Wrap the text of an email message to 79 characters: The inspiration for this challenge. It's the same thing, in reverse. Five easy strokes.
- formatted text to markdown: Formatting text to less than the width of the screen. Plus some other stuff that inflates the stroke count.
- PEP8 Python Wrapping Comments and Code: Formatting code to less than the width of the screen.
- Hanging Indent for Footnotes: There's only one word that needs to be reformatted. Oh well, it counts.
- Cleanining up 80 column concatenated text: This misspelled challenge also joins together formatted lines in a way, but it plays totally different.
- Python: Lots of function arguments: Why did I post this challenge? Anyway, it's sort of similar.
- Convert regular pandoc footnotes to in-line notes: This one is complicated.