Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 5d4cb5ed5f97770009e52f52

Unsemantic linewrapping

[Inspired by a blog post I read: https://scott.mn/2014/02/21/semantic_linewrapping/. Text adapted.] Sometimes when editing a Markdown file, I wrap the lines semantically. Instead of inserting a newline at 70 columns (or whatever), or making paragraphs one long line, I put in newlines at a point that seems logical to me. This may seem silly, but it produces better diffs. Semantic linewrapping also makes editing snappier. I can delete, edit or insert sentences easily using linewise operations. Code-oriented text editors like Vim and [REDACTED] are really good at this kind of manipulation. Editing text that hasn't been wrapped semantically is a pain, though:

Start file
Here is a paragraph with some stuff in it. This is the second sentence. This
sentence is really long, and ugly, and the truth is that it basically says
nothing at all. This is the last sentence of the paragraph; thanks for reading!
End file
Here is a paragraph with some stuff in it. This is the second sentence. This is
the last sentence of the paragraph; thanks for reading!

View Diff

1,3c1,2
< Here is a paragraph with some stuff in it. This is the second sentence. This
< sentence is really long, and ugly, and the truth is that it basically says
< nothing at all. This is the last sentence of the paragraph; thanks for reading!
---
> Here is a paragraph with some stuff in it. This is the second sentence. This is
> the last sentence of the paragraph; thanks for reading!

Solutions

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 117 remaining solutions by signing in and submitting your own entry
#118 Alexander Dikelsky / @ADikelsky - Score: 25 - 08/14/19 @ 20:53
A is<Esc>jdddt.<Esc>dtlithe <Esc>:wq<CR>

0 comments


Created by: @NieDzejkob

118 active golfers, 470 entries

Leaderboard (lowest score wins):
9
#1 - Tencent / @JiezhiG

08/09/2019 at 01:32AM

9
#2 - Daniel Steinberg / @dstein64

08/09/2019 at 01:39AM

9
#3 - sooqua / @sooqua

08/09/2019 at 03:43AM

9
#4 - Jon Krause / @jkrause314

08/09/2019 at 05:06AM

9
#5 - John Braxler / @braxler

08/09/2019 at 12:17PM

9
#6 - Saki Gw / @Sakigw

08/09/2019 at 12:55PM

9
#7 - Frank Malone / @FrankMa00268686

08/09/2019 at 01:35PM

9
#8 - Rob Pilling / @bobrippling

08/09/2019 at 02:08PM

9
#9 - Malcolm Sharpe / @blueblimpms

08/09/2019 at 04:18PM

9
#10 - Petro Тrouq / @zulolosi

08/09/2019 at 05:30PM

9
#11 - Smylers / @Smylers2

08/09/2019 at 09:20PM

9
#12 - Henrique Malheiro / @rike09

08/10/2019 at 01:38AM

9
#13 - Bradley M. Small / @BradleySmall

08/10/2019 at 02:26AM

9
#14 - couaber / @couaber

08/10/2019 at 01:31PM

9
#15 - Titouan Teyssier / @TitouanT_

08/10/2019 at 03:48PM

9
#16 - Tinko Minko / @tandikula

08/12/2019 at 06:08PM

9
#17 - Bob Ren / @bobrenjc93

08/12/2019 at 06:34PM

9
#18 - james_bunch / @james_bunch

08/12/2019 at 10:59PM

9
#19 - Martin Delille / @martinodelilo

08/13/2019 at 03:31PM

9
#20 - Adam Katz / @AdamKat01277576

08/13/2019 at 05:03PM

9
#21 - Fabien C. / @vaga_io

08/13/2019 at 06:39PM

9
#22 - XiaoXiaoLui / @XiaoXiaoLui1

08/15/2019 at 05:11AM

9
#23 - garry quested / @GQuested

08/16/2019 at 11:18AM

9
#24 - Adam Hartz / @awareofnow

08/17/2019 at 07:33PM

9
#25 - theBecwar / @thebecwar

08/20/2019 at 08:50PM

9
#26 - Dax / @zacoxi

08/22/2019 at 05:59AM

9
#27 - Marco Mannucci / @markomannux

08/22/2019 at 08:09AM

9
#28 - blub / @agorilladriving

08/29/2019 at 12:11AM

9
#29 - Andrew Blokzyl / @linuxKd

08/29/2019 at 06:55PM

9
#30 - Bill Ruddock / @biinari

08/31/2019 at 10:46PM