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

0 comments


Created by: @NieDzejkob

64 active golfers, 212 entries

Leaderboard (lowest score wins):
10
#31 - Thomas Tøkje / @tokjenator

08/09/2019 at 02:43PM

10
#32 - Chris Shorrock / @EbinFlow

08/13/2019 at 04:11PM

10
#33 - Jonathan Eidsness / @jonathaneidsnes

08/14/2019 at 08:19PM

10
#34 - Adam Stephen / @2_71828

08/17/2019 at 07:05AM

10
#35 - Mr_Djez / @DjezMr

08/18/2019 at 08:22PM

10
#36 - ameebo / @meebwish546

08/20/2019 at 02:25PM

10
#37 - Stefan Krist / @nerdyness_sk

08/20/2019 at 02:44PM

11
#38 - Ivo Blöchliger / @aigledesalpes

08/09/2019 at 05:22AM

11
#39 - André Reigoto / @AndreReigoto

08/09/2019 at 02:39PM

11
#40 - Gary NPC / @GaryNpc

08/10/2019 at 09:18AM

11
#41 - Fritz Inf / @6360info

08/10/2019 at 02:09PM

11
#42 - Brian Li / @BriungRi

08/12/2019 at 07:56PM

11
#43 - Diego Navarro / @die_4001

08/13/2019 at 05:47PM

11
#44 - Karan Gajwani / @karangb

08/16/2019 at 09:48AM

12
#45 - Vim Golfer / @VimGolfer6

08/09/2019 at 01:17PM

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

08/15/2019 at 07:04PM

13
#47 - I:Boss / @ibossptk

08/12/2019 at 01:14PM

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

08/16/2019 at 02:09PM

13
#49 - Floyd Gantt / @fgantt

08/16/2019 at 07:28PM

14
#50 - Kota Mori / @KotaMori1

08/13/2019 at 10:56PM

14
#51 - Zane / @Zane19489481

08/15/2019 at 03:08PM

15
#52 - Miki Tebeka / @tebeka

08/09/2019 at 05:31AM

15
#53 - Arnaud / @arnaudmm

08/17/2019 at 03:20PM

15
#54 - Phoon / @justflashhim

08/18/2019 at 08:10PM

15
#55 - vim_ninja / @NinjaVim

08/19/2019 at 02:48AM

16
#56 - Derek Schrock / @derekschrock

08/09/2019 at 01:11AM

16
#57 - vimgolfuser123 / @vimgolfuser123

08/13/2019 at 03:20AM

16
#58 - Myki Myke / @myke_myki

08/13/2019 at 09:24AM

16
#59 - Milind Mantri / @MantriMilind

08/15/2019 at 07:46AM

18
#60 - Luiz Eduardo Amaral / @_luxedo

08/13/2019 at 03:56PM