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 1433 remaining solutions by signing in and submitting your own entry
#1434 梁(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

1434 active golfers, 5829 entries

Leaderboard (lowest score wins):
18
#1081 - Ed Leafe / @EdLeafe

06/15/2020 at 11:02PM

18
#1082 - s4k4yume / @s4k4yume1

06/24/2020 at 04:03PM

18
#1083 - Saurav Ray / @sauravpray

07/29/2020 at 11:21AM

18
#1084 - ccoffee_addictt / @ccoffee_addictt

08/23/2020 at 10:31PM

18
#1085 - Toni Lee / @lundbyit

08/24/2020 at 10:29AM

18
#1086 - Mathias / @Mathias70341252

08/28/2020 at 07:43AM

18
#1087 - Mike Rosseel / @mrosseel

08/29/2020 at 10:59PM

18
#1088 - dezhonger / @dezhonger

08/31/2020 at 01:22PM

18
#1089 - edward / @EdwardS00145201

09/03/2020 at 10:58AM

18
#1090 - Václav Pernička / @VaclavPernicka

09/05/2020 at 02:53PM

18
#1091 - GuilhermeGuilhermeGuilherme / @Caneta_Bic_Azul

09/07/2020 at 03:47AM

18
#1092 - TheMagzuz / @DamMarkus

10/08/2020 at 12:54PM

18
#1093 - ms / @ms78270444

10/23/2020 at 01:06PM

18
#1094 - Rafal C. / @RafalC37709324

11/14/2020 at 10:04AM

18
#1095 - hejhopp87 / @hejhopp87

12/06/2020 at 06:53AM

18
#1096 - said / @said13664960

12/16/2020 at 03:14PM

18
#1097 - doran / @doran89993520

12/21/2020 at 06:55PM

18
#1098 - Gunter Kluge / @KlugeGunter

01/02/2021 at 11:38AM

18
#1099 - Ben_Sims_real / @benjami90942066

01/25/2021 at 12:12PM

18
#1100 - Faizan Ansari / @faizan_157

01/31/2021 at 08:05AM

18
#1101 - Anthony / @Palateus

02/10/2021 at 09:58AM

18
#1102 - tom / @marlow_th

05/10/2021 at 06:30PM

19
#1103 - Malachi Phillips / @Malachi72164202

03/01/2020 at 04:13PM

19
#1104 - Sean Stoneburner / @StoneburnerSFW

03/02/2020 at 10:07AM

19
#1105 - David A. Lyon / @dauglyon

03/03/2020 at 11:30PM

19
#1106 - David W / @DavidWi14576388

03/07/2020 at 08:56PM

19
#1107 - ひらの / @uunikura

03/09/2020 at 03:50AM

19
#1108 - Dongwook Lee / @nephilimz

03/13/2020 at 01:53AM

19
#1109 - xer0.5ive / @Bibekshah

03/13/2020 at 02:37AM

19
#1110 - Gabriel Niko Mojica / @MojicaNiko

03/13/2020 at 06:05AM