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

0 comments


Created by: @NieDzejkob

159 active golfers, 636 entries

Leaderboard (lowest score wins):
12
#121 - Cillian Berragan / @cjberragan

10/11/2019 at 09:53PM

12
#122 - None / @sh1chuang

01/09/2020 at 11:57AM

12
#123 - Steve Racanovic / @steve_racanovic

01/16/2020 at 08:39PM

12
#124 - Ron Peters / @thepistonhead

02/14/2020 at 08:39PM

13
#125 - I:Boss / @ibossptk

08/12/2019 at 01:14PM

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

08/16/2019 at 02:09PM

13
#127 - Floyd Gantt / @fgantt

08/16/2019 at 07:28PM

13
#128 - Preetham Maiya / @PreethamMaiya

08/25/2019 at 03:28PM

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

08/31/2019 at 01:21PM

13
#130 - Daniel Beck / @daniel_beck_il

09/10/2019 at 12:48PM

13
#131 - Iggy / @iggredible

09/11/2019 at 03:42AM

13
#132 - Jonathan Lozinski / @jlozinski

09/23/2019 at 12:58PM

13
#133 - 5m0r14x / @5m0r14x

01/10/2020 at 11:34PM

14
#134 - Kota Mori / @KotaMori1

08/13/2019 at 10:56PM

14
#135 - Zane / @Zane19489481

08/15/2019 at 03:08PM

14
#136 - Alex Emelianov / @AlexEmelianov3

10/26/2019 at 04:56AM

14
#137 - Jonathan Jeffrey / @projjects

12/06/2019 at 03:26PM

14
#138 - Nihil / @Nihil3

02/21/2020 at 08:34PM

15
#139 - Miki Tebeka / @tebeka

08/09/2019 at 05:31AM

15
#140 - Arnaud / @arnaudmm

08/17/2019 at 03:20PM

15
#141 - Phoon / @justflashhim

08/18/2019 at 08:10PM

15
#142 - vim_ninja / @NinjaVim

08/19/2019 at 02:48AM

15
#143 - Gunnar Thoreson / @ThReGgOn

09/05/2019 at 01:02PM

15
#144 - Zviad Mgaloblishvili / @ZMgaloblishvili

10/10/2019 at 02:31PM

16
#145 - Derek Schrock / @derekschrock

08/09/2019 at 01:11AM

16
#146 - vimgolfuser123 / @vimgolfuser123

08/13/2019 at 03:20AM

16
#147 - Myki Myke / @myke_myki

08/13/2019 at 09:24AM

16
#148 - Milind Mantri / @MantriMilind

08/15/2019 at 07:46AM

16
#149 - Ariel Miculas / @ArielMiculas

09/18/2019 at 04:38PM

16
#150 - Bhagwan / @El_Bhagwan

05/11/2020 at 08:21PM