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 207 remaining solutions by signing in and submitting your own entry
#208 지형 유 / @O_hr_good7 - Score: 52 - 04/05/22 @ 19:22
<Up><Down>dd<Right><Right><Right>wwwww<Left><Left><Left><Left><Left>i<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><Right><Right><Right><Right><Right><Right><CR><BS><Right><CR><Esc>ZZ

0 comments


Created by: @NieDzejkob

208 active golfers, 826 entries

Leaderboard (lowest score wins):
15
#181 - Miki Tebeka / @tebeka

08/09/2019 at 05:31AM

15
#182 - Arnaud / @arnaudmm

08/17/2019 at 03:20PM

15
#183 - Phoon / @justflashhim

08/18/2019 at 08:10PM

15
#184 - vim_ninja / @NinjaVim

08/19/2019 at 02:48AM

15
#185 - Gunnar Thoreson / @ThReGgOn

09/05/2019 at 01:02PM

15
#186 - Zviad Mgaloblishvili / @ZMgaloblishvili

10/10/2019 at 02:31PM

15
#187 - Seve / @Seve_py

08/11/2020 at 09:21AM

15
#188 - Manas / @weirdsmiley_

01/12/2021 at 04:33AM

16
#189 - Derek Schrock / @derekschrock

08/09/2019 at 01:11AM

16
#190 - vimgolfuser123 / @vimgolfuser123

08/13/2019 at 03:20AM

16
#191 - Myki Myke / @myke_myki

08/13/2019 at 09:24AM

16
#192 - Milind Mantri / @MantriMilind

08/15/2019 at 07:46AM

16
#193 - Ariel Miculas / @ArielMiculas

09/18/2019 at 04:38PM

16
#194 - iBhagwan / @iiBhagwan

05/11/2020 at 08:21PM

16
#195 - :wq / @write_quit_22

05/24/2021 at 09:40PM

17
#196 - Bitt Faulk / @bittfaulk

02/20/2020 at 09:27PM

18
#197 - Luiz Eduardo Amaral / @_luxedo

08/13/2019 at 03:56PM

18
#198 - dahara / @kuma_moooon

08/15/2019 at 03:01PM

18
#199 - this is for vim golf / @Dis4VimGolf

01/28/2021 at 04:54PM

19
#200 - Paul Inc / @hiniol1982

08/14/2019 at 07:04PM

20
#201 - Aaron / @_Lordofthevoid_

11/22/2019 at 03:03PM

21
#202 - Max Williams / @notmaxbutmax

10/15/2019 at 11:45PM

22
#203 - Cliff Chung / @CliffChung

08/16/2019 at 06:49PM

22
#204 - shaik azhar madar / @azarudu

04/08/2021 at 04:22AM

23
#205 - leo / @leo28356948

10/17/2019 at 11:59AM

23
#206 - vito / @vito49999722

09/05/2020 at 10:33AM

25
#207 - Alexander Dikelsky / @ADikelsky

08/14/2019 at 08:53PM

52
#208 - 지형 유 / @O_hr_good7

04/05/2022 at 07:22PM