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):
11
#571 - David Martínez / @g0ddrinksjava

08/07/2020 at 08:11PM

11
#572 - Kazuki / @algo__n

08/08/2020 at 03:33PM

11
#573 - Vinay Sharma / @VinaySh63956554

08/08/2020 at 04:03PM

11
#574 - Martin Bielik / @mabielik

08/09/2020 at 08:43PM

11
#575 - human13 / @human0013

08/12/2020 at 09:54PM

11
#576 - João Pedro B Nadas / @jpnadas

08/14/2020 at 02:34PM

11
#577 - Martin Kauppinen / @MartinKauppinen

08/14/2020 at 02:47PM

11
#578 - gfe fag / @FagGfe

08/19/2020 at 01:01PM

11
#579 - CultureOfCritique / @OfCritique

08/20/2020 at 02:50AM

11
#580 - knoebber / @knoebber1

08/20/2020 at 08:38PM

11
#581 - Seth Y / @RealNancyReagan

08/22/2020 at 03:43AM

11
#582 - s3cy / @s3cyxx

08/23/2020 at 10:59AM

11
#583 - Thomas Faivre / @faivre_thomas

08/23/2020 at 08:20PM

11
#584 - fenn.stefan@gmail.com / @FennStefan

08/26/2020 at 07:45PM

11
#585 - Aaron W / @aarwei

08/28/2020 at 01:13AM

11
#586 - Leiser Fernández / @leiserfg

08/28/2020 at 12:18PM

11
#587 - cosh / @coshxx

08/29/2020 at 05:37PM

11
#588 - Tom Dalling / @tom_dalling

08/30/2020 at 01:10PM

11
#589 - Yasky / @Yaasky

09/02/2020 at 07:11PM

11
#590 - Muffin / @Muffin91707986

09/03/2020 at 08:50PM

11
#591 - Yannick / @Yannick88147038

09/05/2020 at 06:26PM

11
#592 - Kurt Keller / @KurtKeller

09/07/2020 at 07:09PM

11
#593 - Pepe / @PedroVassena

09/10/2020 at 05:11AM

11
#594 - Blipss / @BlipSound

09/10/2020 at 08:54PM

11
#595 - mevmev / @mevmev8

09/13/2020 at 01:41PM

11
#596 - Pieter-Jan Lavaerts / @Pumpkin_Pie_Eat

09/15/2020 at 01:47PM

11
#597 - chaotic / @laersn

09/17/2020 at 12:42PM

11
#598 - Mike Walker / @mikewalk

09/19/2020 at 12:31PM

11
#599 - Olivier Martin / @oliviermartin

09/20/2020 at 06:58PM

11
#600 - Shunichi Kanade / @shunkana

09/22/2020 at 03:37AM