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

1536 active golfers, 6304 entries

Leaderboard (lowest score wins):
10
#1 - Saki Gw / @Sakigw

02/20/2020 at 11:51AM

10
#2 - Anthony BERNARD / @TweetTontony

02/20/2020 at 01:35PM

10
#3 - Ollin Boer Bohan / @madebyollin

02/20/2020 at 02:32PM

10
#4 - John Braxler / @braxler

02/20/2020 at 04:41PM

10
#5 - Dan / @dstein64

02/20/2020 at 05:19PM

10
#6 - Brian Jesse / @Brain_Bacon

02/21/2020 at 08:51AM

10
#7 - Adam Sanghera / @AdamSanghera

02/21/2020 at 06:18PM

10
#8 - dryaurtis / @dryaurtis

02/23/2020 at 08:55AM

10
#9 - Ben Griffiths / @beng

02/24/2020 at 09:15AM

10
#10 - TimMcGuire / @mcguire

02/24/2020 at 03:48PM

10
#11 - Smylers / @Smylers2

02/24/2020 at 04:00PM

10
#12 - Mushan Yang / @mushanyoung

02/24/2020 at 10:19PM

10
#13 - stevan / @stevan76107116

02/24/2020 at 10:21PM

10
#14 - yhetsugiHMC / @yhetsugi

02/25/2020 at 01:10AM

10
#15 - golferN / @golferN3

02/25/2020 at 06:25PM

10
#16 - David Hume / @djh95

02/25/2020 at 09:55PM

10
#17 - howanto / @ho_wan_

02/25/2020 at 11:48PM

10
#18 - Hyunjoon / @yi_hyunjoon

02/27/2020 at 08:28AM

10
#19 - Jonathan Stinson / @KnightdeadJohn

02/27/2020 at 01:06PM

10
#20 - Johnny John / @JohnnyJ74406671

02/27/2020 at 06:42PM

10
#21 - Scott Lee / @ureure

02/27/2020 at 11:15PM

10
#22 - Jangsea Park / @jangsea

02/28/2020 at 05:18PM

10
#23 - Oleg / @colega

02/29/2020 at 10:27AM

10
#24 - Максим Селиверстов / @max_developer

02/29/2020 at 04:36PM

10
#25 - Matt Drover / @mdrover25

03/01/2020 at 02:12PM

10
#26 - Aníbal / @anibal10

03/01/2020 at 05:40PM

10
#27 - Mark Oswald / @mrkosw

03/02/2020 at 03:38AM

10
#28 - Tefe / @tefetic

03/02/2020 at 08:32PM

10
#29 - Tinko Minko / @tandikula

03/03/2020 at 06:31PM

10
#30 - ipv4 has run out / @jchook

03/04/2020 at 01:15AM