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

1174 active golfers, 4856 entries

Leaderboard (lowest score wins):
10
#91 - Moatvald / @moatvald

04/10/2020 at 09:42AM

10
#92 - edvrds / @edvrds

04/11/2020 at 04:59PM

10
#93 - Vinh Vu / @vinhhv94

04/12/2020 at 08:31AM

10
#94 - mackermann / @mackermann12

04/12/2020 at 07:15PM

10
#95 - caffeineism / @caffeineism

04/15/2020 at 08:27PM

10
#96 - David / @imdavidhwang

04/16/2020 at 10:34PM

10
#97 - Sikker Rosendal / @srosendaldk

04/18/2020 at 10:50AM

10
#98 - Toby de Havilland / @tobydeh

04/18/2020 at 08:48PM

10
#99 - Miłosz Łakomy / @foobar01123

04/19/2020 at 04:50AM

10
#100 - Ebi / @ehan6

04/19/2020 at 07:49AM

10
#101 - fortran0303 / @fortran0303

04/23/2020 at 12:40PM

10
#102 - António Almeida / @tonydapinta

04/23/2020 at 02:34PM

10
#103 - TelevisedURL / @sharerecord

04/25/2020 at 03:41AM

10
#104 - John Sumner / @rjsumner

04/26/2020 at 01:08PM

10
#105 - Florian Martin / @Florian72650031

04/29/2020 at 01:10AM

10
#106 - Arthur Goodman / @ArthurGoodman3

04/29/2020 at 03:06PM

10
#107 - Christophe Kafrouni / @KafrouniChris

04/30/2020 at 01:43PM

10
#108 - nick / @Xp_Bar

04/30/2020 at 09:40PM

10
#109 - Shivam mehta / @maniac_en

05/01/2020 at 10:39AM

10
#110 - Cam / @camxcube

05/01/2020 at 12:36PM

10
#111 - Patrick Sanan / @patricksanan

05/02/2020 at 12:20PM

10
#112 - bladehaze / @bladehaze

05/02/2020 at 01:52PM

10
#113 - Tiago Nascimento / @tigum27

05/02/2020 at 09:28PM

10
#114 - whale / @Hari84444713

05/03/2020 at 08:38PM

10
#115 - Sime Buljac / @sim_bul

05/03/2020 at 08:40PM

10
#116 - Toby Hawkins / @Toby_Hawkins

05/04/2020 at 03:55PM

10
#117 - r4d1um / @r4d1um

05/04/2020 at 06:53PM

10
#118 - Joseph Porter / @jmp392

05/04/2020 at 08:00PM

10
#119 - Matthias Wolf / @matz__e

05/05/2020 at 07:24AM

10
#120 - Samuel Vaiter / @vaiter

05/05/2020 at 12:07PM