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

912 active golfers, 3827 entries

Leaderboard (lowest score wins):
10
#31 - countime / @countime1

03/04/2020 at 01:53AM

10
#32 - Paul Parker / @PaulDesmoParker

03/04/2020 at 11:03AM

10
#33 - Xiangyu Xu / @bkbncn

03/05/2020 at 02:41AM

10
#34 - Andre / @5starsmug

03/06/2020 at 11:55PM

10
#35 - Bashar Jaan Khan / @basharjaankhan

03/07/2020 at 09:55AM

10
#36 - Karissa McKelvey / @okdistribute

03/09/2020 at 10:11PM

10
#37 - Wouter Horlings / @Achilleshiel

03/10/2020 at 03:58PM

10
#38 - Kevin Ullmann / @kevosauce

03/10/2020 at 11:48PM

10
#39 - せいほう / @FICSQF

03/12/2020 at 08:42AM

10
#40 - Viktor Styrud / @ViktorStyrud

03/12/2020 at 03:39PM

10
#41 - Sean Dewar / @seandewar

03/12/2020 at 04:58PM

10
#42 - Sylvain Leroux / Yes, I Know IT ! / @Yes_I_Know_IT

03/12/2020 at 08:47PM

10
#43 - Tomas / @Tombakas

03/13/2020 at 05:41PM

10
#44 - Ryan Nevius / @ryannevius

03/14/2020 at 09:30AM

10
#45 - 63RC-LRMn-cXC4-v8NJ / @63rcV

03/14/2020 at 04:33PM

10
#46 - yar / @yar01921320

03/14/2020 at 11:13PM

10
#47 - Niklas Ydebäck / @Ydebaeck

03/15/2020 at 01:48AM

10
#48 - samet ぷ / @jssamet

03/15/2020 at 10:52AM

10
#49 - giursino / @giursino1

03/15/2020 at 12:25PM

10
#50 - Anton Kriese / @AntonKriese

03/15/2020 at 02:06PM

10
#51 - 杜撰 / @NOrUixDzwW4BbCP

03/15/2020 at 07:00PM

10
#52 - MeestaWong / @MeestaWong

03/15/2020 at 10:54PM

10
#53 - John / @JohnJDoe2

03/16/2020 at 09:03AM

10
#54 - majo senf / @majo_senf

03/16/2020 at 12:52PM

10
#55 - antoine mas / @aneomas

03/16/2020 at 04:48PM

10
#56 - Jose Soto / @JoseCanHelp

03/17/2020 at 06:57AM

10
#57 - noredigle / @noredigle

03/17/2020 at 05:06PM

10
#58 - vicver09 / @vicver091

03/19/2020 at 12:26AM

10
#59 - ちゅうい / @_chuyii

03/20/2020 at 12:58PM

10
#60 - manfred knapp / @fred_pooshka

03/20/2020 at 09:03PM