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 198 remaining solutions by signing in and submitting your own entry
#199 Alexander Dikelsky / @ADikelsky - Score: 25 - 08/14/19 @ 20:53
A is<Esc>jdddt.<Esc>dtlithe <Esc>:wq<CR>

0 comments


Created by: @NieDzejkob

199 active golfers, 798 entries

Leaderboard (lowest score wins):
10
#121 - BnnGolfer / @BnnGolfer

03/28/2020 at 02:48PM

10
#122 - RaylanFox / @RaylanFox

04/11/2020 at 06:48PM

10
#123 - volandkit / @volandkit

04/22/2020 at 06:56PM

10
#124 - Soumadeep Saha / @SoumadeepSaha8

05/10/2020 at 01:49AM

10
#125 - Robberechts Arne / @ArneRobberechts

06/14/2020 at 07:44PM

10
#126 - Jan Sturm / @JanSturm77

07/15/2020 at 12:33PM

10
#127 - Martin Bielik / @mabielik

09/05/2020 at 09:52PM

10
#128 - Brendan Schaenzer / @bschaenzer

09/30/2020 at 01:07PM

10
#129 - quemeraisc / @quemeraisc

11/06/2020 at 01:40PM

10
#130 - hepebexè / @hepebexe

11/20/2020 at 07:18PM

10
#131 - chocolate / @chocola81394123

11/24/2020 at 06:04AM

10
#132 - 영훈 / @odjfnrtm

12/27/2020 at 07:09AM

10
#133 - roudens / @roudens2

12/28/2020 at 01:45PM

11
#134 - Ivo Blöchliger / @aigledesalpes

08/09/2019 at 05:22AM

11
#135 - André Reigoto / @AndreReigoto

08/09/2019 at 02:39PM

11
#136 - Gary NPC / @GaryNpc

08/10/2019 at 09:18AM

11
#137 - Fritz Inf / @6360info

08/10/2019 at 02:09PM

11
#138 - Brian Li / @BriungRi

08/12/2019 at 07:56PM

11
#139 - Diego Navarro / @die_4001

08/13/2019 at 05:47PM

11
#140 - Karan Gajwani / @karangb

08/16/2019 at 09:48AM

11
#141 - vicver09 / @vicver091

10/27/2019 at 02:27PM

11
#142 - shota_ogswr / @shota_ogasawara

11/26/2019 at 03:08PM

11
#143 - ladydidanslemur / @ldddlm

12/24/2020 at 12:13PM

11
#144 - Camden Cheek / @ccheek21

01/15/2021 at 11:09PM

12
#145 - Vim Golfer / @VimGolfer6

08/09/2019 at 01:17PM

12
#146 - ʀǟɦʊʟ ɮɦօʟǟ / @theRahulBhola

08/15/2019 at 07:04PM

12
#147 - BaffaloP 🐃🎨 / @bbaffalopp

09/09/2019 at 10:31PM

12
#148 - crazydon1 / @crazydon19

09/16/2019 at 11:14AM

12
#149 - Cillian Berragan / @cjberragan

10/11/2019 at 09:53PM

12
#150 - None / @sh1chuang

01/09/2020 at 11:57AM