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

0 comments


Created by: @NieDzejkob

195 active golfers, 779 entries

Leaderboard (lowest score wins):
9
#61 - Rodrigo V. Lopes / @rodvlopes

04/10/2020 at 08:20PM

9
#62 - Moatvald / @moatvald

04/18/2020 at 07:00AM

9
#63 - edvrds / @edvrds

04/18/2020 at 08:00PM

9
#64 - Jason / @roosjason

04/18/2020 at 11:13PM

9
#65 - Arthur Goodman / @ArthurGoodman3

05/01/2020 at 11:22AM

9
#66 - Mack Hutsell / @sellshuts

05/25/2020 at 12:46AM

9
#67 - 于吉星 / @fishermryn

05/28/2020 at 06:15AM

9
#68 - RockerZZY / @rocker_zzy

05/28/2020 at 11:57PM

9
#69 - Kevin Keefe / @KevinKeefe5

06/04/2020 at 12:35AM

9
#70 - せいほう / @FICSQF

06/06/2020 at 11:45AM

9
#71 - Valdimar / @genkobar

06/07/2020 at 08:49PM

9
#72 - majo senf / @majo_senf

07/14/2020 at 09:12AM

9
#73 - Till Straube / @tillstr

07/29/2020 at 09:04AM

9
#74 - Filipe Brandenburger / @filbranden

08/11/2020 at 04:13PM

9
#75 - Tanzeel Kazi / @tanzeelkazi

08/18/2020 at 01:45AM

9
#76 - Kaustubh Murumkar / @k_austub_h

08/31/2020 at 08:57PM

9
#77 - Blake Tereau / @BlakeTereau

09/11/2020 at 02:50AM

9
#78 - TimMcGuire / @mcguire

09/15/2020 at 06:21PM

9
#79 - lamtt77 / @lamtt77

10/11/2020 at 06:25AM

9
#80 - Henry MATHEISEN / @hmatheisen

10/22/2020 at 01:15PM

9
#81 - finkrer / @finkrer

11/11/2020 at 12:50PM

9
#82 - f a / @5eraf

12/02/2020 at 08:46PM

9
#83 - Demian Martinez / @demianuco

12/09/2020 at 08:53PM

9
#84 - Ray Dennis / @raysden

01/05/2021 at 09:01PM

9
#85 - Jung Yeon Park / @park_jungy

01/08/2021 at 01:02AM

9
#86 - Björn Struckmeier / @BjrnStruckmeie1

01/08/2021 at 11:27AM

9
#87 - A A A / @37fatos

01/12/2021 at 02:49AM

10
#88 - Valacar / @valacar

08/09/2019 at 04:58AM

10
#89 - John / @JohnJDoe2

08/09/2019 at 06:51AM

10
#90 - Jan Bundesmann / @janbundesmann

08/09/2019 at 07:08AM