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

0 comments


Created by: @NieDzejkob

105 active golfers, 390 entries

Leaderboard (lowest score wins):
9
#31 - pommevilla / @pawlrus

09/03/2019 at 06:56PM

9
#32 - Baine Wedlock / @BaineWedlock

09/06/2019 at 10:26AM

9
#33 - Zach Ingbretsen / @ZIngbretsen

09/07/2019 at 03:22PM

9
#34 - lucca augusto / @LuccaAugusto6

09/08/2019 at 02:08PM

9
#35 - vimgolfer / @vimgolfer7

09/21/2019 at 02:32PM

9
#36 - Viktor Styrud / @Visklol

09/23/2019 at 08:55AM

9
#37 - brypto / @hiimbenjy

09/30/2019 at 10:15PM

9
#38 - Andrzej Wąsowski / @AndrzejWasowski

10/06/2019 at 09:27AM

9
#39 - Soptik / @Soptik3

10/10/2019 at 08:28PM

9
#40 - Sam O'Malley / @Samuel_OMalley

10/12/2019 at 03:49AM

9
#41 - kkscr / @kkscr1

10/13/2019 at 02:19PM

9
#42 - Mario Olofo / @mario_olofo

10/17/2019 at 04:36AM

9
#43 - Jonathan Medwig / @jmedwig

10/17/2019 at 02:38PM

9
#44 - Tamás Kárándi / @tkarandi

10/19/2019 at 05:56PM

9
#45 - Ivan Volosyuk / @IvanVolosyuk

10/21/2019 at 09:12AM

10
#46 - Valacar / @valacar

08/09/2019 at 04:58AM

10
#47 - John / @JohnJDoe2

08/09/2019 at 06:51AM

10
#48 - Jan Bundesmann / @janbundesmann

08/09/2019 at 07:08AM

10
#49 - Chester Yap / @Chest_ErYap

08/09/2019 at 02:37PM

10
#50 - Thomas Tøkje / @tokjenator

08/09/2019 at 02:43PM

10
#51 - Chris Shorrock / @EbinFlow

08/13/2019 at 04:11PM

10
#52 - Jonathan Eidsness / @jonathaneidsnes

08/14/2019 at 08:19PM

10
#53 - Adam Stephen / @2_71828

08/17/2019 at 07:05AM

10
#54 - Mr_Djez / @DjezMr

08/18/2019 at 08:22PM

10
#55 - ameebo / @meebwish546

08/20/2019 at 02:25PM

10
#56 - Stefan Krist / @nerdyness_sk

08/20/2019 at 02:44PM

10
#57 - kevinski / @kevinsk30746831

08/22/2019 at 05:12PM

10
#58 - Simon Wilkinson / @simondwilkinson

08/24/2019 at 03:18PM

10
#59 - sundeep routhu / @sundeep12005

08/29/2019 at 04:56PM

10
#60 - Christian / @paierlep

08/31/2019 at 08:36AM