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

0 comments


Created by: @NieDzejkob

197 active golfers, 796 entries

Leaderboard (lowest score wins):
12
#151 - Steve Racanovic / @steve_racanovic

01/16/2020 at 08:39PM

12
#152 - Ron Peters / @thepistonhead

02/14/2020 at 08:39PM

12
#153 - Rustem B. / @_rustemb

07/31/2020 at 12:20PM

12
#154 - Martin Kauppinen / @MartinKauppinen

08/16/2020 at 01:17PM

13
#155 - I:Boss / @ibossptk

08/12/2019 at 01:14PM

13
#156 - Nicolas πŸ‘¨β€πŸ’»πŸ‡¨πŸ‡¦ / @martinni39

08/16/2019 at 02:09PM

13
#157 - Floyd Gantt / @fgantt

08/16/2019 at 07:28PM

13
#158 - Preetham Maiya / @PreethamMaiya

08/25/2019 at 03:28PM

13
#159 - γ˜γ‚“γΊγƒΌ / @jinpei0908

08/31/2019 at 01:21PM

13
#160 - Daniel Beck / @daniel_beck_il

09/10/2019 at 12:48PM

13
#161 - Iggy / @iggredible

09/11/2019 at 03:42AM

13
#162 - Jonathan Lozinski / @jlozinski

09/23/2019 at 12:58PM

13
#163 - 5m0r14x / @5m0r14x

01/10/2020 at 11:34PM

13
#164 - drGsus / @drGsus

07/26/2020 at 10:11AM

13
#165 - Du Phan / @fehiepsi

08/31/2020 at 08:28PM

13
#166 - abhijeet patil / @abhijeetptl5

09/04/2020 at 09:44AM

13
#167 - mevmev / @mevmev8

10/06/2020 at 01:03PM

13
#168 - Fabrizio Perria / @FPerria

12/27/2020 at 03:10PM

14
#169 - Kota Mori / @KotaMori1

08/13/2019 at 10:56PM

14
#170 - Zane / @Zane19489481

08/15/2019 at 03:08PM

14
#171 - Alex Emelianov / @AlexEmelianov3

10/26/2019 at 04:56AM

14
#172 - Jonathan Jeffrey / @projjects

12/06/2019 at 03:26PM

14
#173 - Nihil / @Nihil3

02/21/2020 at 08:34PM

15
#174 - Miki Tebeka / @tebeka

08/09/2019 at 05:31AM

15
#175 - Arnaud / @arnaudmm

08/17/2019 at 03:20PM

15
#176 - Phoon / @justflashhim

08/18/2019 at 08:10PM

15
#177 - vim_ninja / @NinjaVim

08/19/2019 at 02:48AM

15
#178 - Gunnar Thoreson / @ThReGgOn

09/05/2019 at 01:02PM

15
#179 - Zviad Mgaloblishvili / @ZMgaloblishvili

10/10/2019 at 02:31PM

15
#180 - Seve / @Seve_py

08/11/2020 at 09:21AM