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

0 comments


Created by: @NieDzejkob

182 active golfers, 730 entries

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

11/06/2020 at 01:40PM

10
#122 - hepebexè / @hepebexe

11/20/2020 at 07:18PM

11
#123 - Ivo Blöchliger / @aigledesalpes

08/09/2019 at 05:22AM

11
#124 - André Reigoto / @AndreReigoto

08/09/2019 at 02:39PM

11
#125 - Gary NPC / @GaryNpc

08/10/2019 at 09:18AM

11
#126 - Fritz Inf / @6360info

08/10/2019 at 02:09PM

11
#127 - Brian Li / @BriungRi

08/12/2019 at 07:56PM

11
#128 - Diego Navarro / @die_4001

08/13/2019 at 05:47PM

11
#129 - Karan Gajwani / @karangb

08/16/2019 at 09:48AM

11
#130 - vicver09 / @vicver091

10/27/2019 at 02:27PM

11
#131 - shota_ogswr / @shota_ogasawara

11/26/2019 at 03:08PM

12
#132 - Vim Golfer / @VimGolfer6

08/09/2019 at 01:17PM

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

08/15/2019 at 07:04PM

12
#134 - BaffaloP 🐃🎨 / @bbaffalopp

09/09/2019 at 10:31PM

12
#135 - crazydon1 / @crazydon19

09/16/2019 at 11:14AM

12
#136 - Cillian Berragan / @cjberragan

10/11/2019 at 09:53PM

12
#137 - None / @sh1chuang

01/09/2020 at 11:57AM

12
#138 - Steve Racanovic / @steve_racanovic

01/16/2020 at 08:39PM

12
#139 - Ron Peters / @thepistonhead

02/14/2020 at 08:39PM

12
#140 - Rustem B. / @_rustemb

07/31/2020 at 12:20PM

12
#141 - Martin Kauppinen / @MartinKauppinen

08/16/2020 at 01:17PM

13
#142 - I:Boss / @ibossptk

08/12/2019 at 01:14PM

13
#143 - Nicolas 👨‍💻🇨🇦 / @martinni39

08/16/2019 at 02:09PM

13
#144 - Floyd Gantt / @fgantt

08/16/2019 at 07:28PM

13
#145 - Preetham Maiya / @PreethamMaiya

08/25/2019 at 03:28PM

13
#146 - じんぺー / @jinpei0908

08/31/2019 at 01:21PM

13
#147 - Daniel Beck / @daniel_beck_il

09/10/2019 at 12:48PM

13
#148 - Iggy / @iggredible

09/11/2019 at 03:42AM

13
#149 - Jonathan Lozinski / @jlozinski

09/23/2019 at 12:58PM

13
#150 - 5m0r14x / @5m0r14x

01/10/2020 at 11:34PM