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

1085 active golfers, 4501 entries

Leaderboard (lowest score wins):
11
#391 - Manikkumar / @ManikkumarK

05/08/2020 at 02:11AM

11
#392 - Fnord Everywhere / @FnordE

05/08/2020 at 01:14PM

11
#393 - Georg Kaaserer / @climbim

05/08/2020 at 09:58PM

11
#394 - Fabian Ahbeck / @FAhbeck

05/08/2020 at 11:06PM

11
#395 - jhoanfalcon / @jhoanfalcon1

05/10/2020 at 01:09PM

11
#396 - ThrowawayProbably912 / @TProbably912

05/10/2020 at 04:31PM

11
#397 - Bhagwan / @El_Bhagwan

05/11/2020 at 12:17AM

11
#398 - io / @iovis9

05/11/2020 at 05:07AM

11
#399 - Francisco Romero / @PanchoopRomero

05/11/2020 at 10:09PM

11
#400 - Adam Bumpus / @bumpus_adam

05/12/2020 at 02:03AM

11
#401 - rootsandrain.com / @rootsandrain

05/13/2020 at 08:06AM

11
#402 - a quiet misdreavus / @QuietMisdreavus

05/13/2020 at 06:19PM

11
#403 - thiago / @higoatcc

05/14/2020 at 02:33AM

11
#404 - Sven Kõiv / @KoivSven

05/14/2020 at 07:50PM

11
#405 - Day / @demigirl_day

05/14/2020 at 09:41PM

11
#406 - Fabien C. / @vaga_io

05/15/2020 at 08:50AM

11
#407 - Sean M / @Sean__Z

05/15/2020 at 02:00PM

11
#408 - Jake Utley / @jakeutley

05/15/2020 at 06:26PM

11
#409 - Satish Maurya / @maurya777

05/21/2020 at 03:04AM

11
#410 - Roland Crosby / @roooooland

05/21/2020 at 08:08PM

11
#411 - Greg Lee / @real_gregliest

05/22/2020 at 06:08PM

11
#412 - Steve Bitner / @fourbitbots

05/26/2020 at 01:31AM

11
#413 - Elizabeth / @sprinkles418

05/28/2020 at 01:54PM

11
#414 - Christian Soltermann / @SoltyChristian

05/30/2020 at 01:35AM

11
#415 - Bob / @Bob37174065

06/01/2020 at 11:48AM

11
#416 - Soptik / @Soptik3

06/02/2020 at 11:05AM

11
#417 - Ben Simmons / @Simmons_Ben

06/02/2020 at 09:52PM

11
#418 - Weird al / @QwertytrewQs

06/03/2020 at 09:30PM

11
#419 - Romain / @djizeuscoco

06/04/2020 at 04:28PM

11
#420 - Gabriel Siqueira / @gabrielhsiq

06/05/2020 at 05:54PM