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 5e4dfcccaa2db400090b66c3

prepend * to every non-blank line

Prepend an asterisk to every non-blank line in the input file.

Start file
This is a
very short

file, but it is 
still
full

of

surpises.
End file
*This is a
*very short

*file, but it is 
*still
*full

*of

*surpises.

View Diff

1,2c1,2
< This is a
< very short
---
> *This is a
> *very short
4,6c4,6
< file, but it is 
< still
< full
---
> *file, but it is 
> *still
> *full
8c8
< of
---
> *of
10c10
< surpises.
---
> *surpises.

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 1420 remaining solutions by signing in and submitting your own entry
#1421 梁(Liang リャン) / @starduliang - Score: 421 - 03/01/20 @ 11:54
:5s/^.+$/<Left><Left><Left><Left><Left><Left><Left><BS>%<Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>i<BS>I*<CR><Up><CR><Esc><Esc><Esc><Esc><Esc>:%s/^<Left><Left><BS><BS>g<Right><Right><Right>.+$/I*<CR><Esc>/<BS>:g/^/*<CR>llllhhh<Esc>uuu<Esc>uujjjkkk/<Esc><Esc>/<BS>:g/^$<Esc><Esc><Esc>jj<Esc><Esc><Esc>:noh<CR>uu/<Esc><Esc>:s%/^/*<CR>:<Up>/<CR><CR>:<Up><Left><Left><Left><Left><Left><Left><BS><Right>%<BS>s<Right><Right><Right><Right><Right><Right><CR><Esc>u<Esc>u<Esc>u<Esc>u<Esc>u<Esc>:noh<CR>:g/^/*/<CR>:noh<CR>:<Up><Up><Left><Left><Left><Left><Left><Left><Left><Left><Right><Right><Right><Right><Right><Right><Right><Left><Left><Left><Left><Left><BS>g<CR>:noh<CR><Esc>:%s/^<Esc><Esc>jjjjjjjj:g/^\S<Left><Left>[<Right><Right><Right>]+$/*&/<CR>:<Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><BS>%s<Right><Right><Right><Right><CR>:<Up><Left><Left> <CR>:<Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><BS><BS><CR>:<Up><Left><Left><Left><Left><Left><Left><Left><Left><BS><Right><Right><Right><BS><Right><Right><CR>:<Up><Left><Left><Left><Left><Left>\<CR>:q<Esc><Esc><Esc>u:<Up><Up><Left><Esc><Esc><Esc>;<Esc>:noh<CR>:<Up><Up><Left>&<CR>u<Esc>:noh<CR>:<Up><Up><Left><Left><Left><Left><Left><Left><Left><Left><Left>.*<Right><Right>.*<Right><Right><Right><Right><Right><Right><Right><Right><CR>:<Up><Left><Left><Left><Left><Esc>b:<Up><Left><Left><Left><Left><Left><BS><BS><Left><Left><Left><Left><Left><Right><Right><Right><Right><CR>:wq<CR>

0 comments


Created by: @johnreitano

1421 active golfers, 5776 entries

Leaderboard (lowest score wins):
10
#331 - Herman Stavelin / @HsBruker

10/19/2020 at 06:26PM

10
#332 - Leland Paul Kusmer / @lelandpaul

10/20/2020 at 02:08PM

10
#333 - Ansel Bobrow / @garlicWharfRat

10/21/2020 at 03:22AM

10
#334 - Hossein Yousefi / @u_hossein

10/23/2020 at 01:26PM

10
#335 - LeCodeurFou / @le_codeur

10/23/2020 at 01:27PM

10
#336 - Blacksquare Gaming Studio / @BlacksquareGam1

10/23/2020 at 01:30PM

10
#337 - wilsonept / @wilsonept1

10/24/2020 at 03:50PM

10
#338 - Alex / @SaidTheAlex

10/25/2020 at 06:46AM

10
#339 - TW / @tangw

10/25/2020 at 09:48PM

10
#340 - Andrzej Wąsowski / @AndrzejWasowski

10/29/2020 at 05:13PM

10
#341 - dadams2 / @dadams217

10/30/2020 at 02:13PM

10
#342 - daniao / @dan1ao

11/01/2020 at 12:14PM

10
#343 - Ravi S Sinha / @ambidextrousTx

11/03/2020 at 03:08AM

10
#344 - Cornelius Roemer / @CorneliusRoemer

11/04/2020 at 06:52PM

10
#345 - Joey Pilla / @joey_pilla

11/05/2020 at 12:39AM

10
#346 - Arryue / @Arryue2

11/06/2020 at 02:20AM

10
#347 - Jacques Donnelly / @Donnll

11/07/2020 at 02:44PM

10
#348 - Corentin / @OuterHeavenCC

11/07/2020 at 10:41PM

10
#349 - vimspam / @vimspam

11/09/2020 at 03:04AM

10
#350 - Leo / @leosolidum

11/12/2020 at 08:38AM

10
#351 - David Kutschke / @D4KU_

11/14/2020 at 12:26PM

10
#352 - 이준희 / @0AKl2TLu2sjExmj

11/14/2020 at 01:27PM

10
#353 - Andreas Siegrist / @andreaszwei

11/15/2020 at 01:41AM

10
#354 - dmr / @dmr83826643

11/17/2020 at 02:45PM

10
#355 - Lashoun / @lashoun42

11/17/2020 at 03:07PM

10
#356 - SilviaRodriguez / @Rodrigu3zSilvia

11/22/2020 at 08:38PM

10
#357 - Andreas Näsman / @andreas_nasman

11/22/2020 at 09:46PM

10
#358 - quemeraisc / @quemeraisc

11/23/2020 at 10:54AM

10
#359 - Andrew Lewis / @droosec

11/23/2020 at 09:17PM

10
#360 - Hugh / @haquaman

11/24/2020 at 02:58AM