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

1151 active golfers, 4775 entries

Leaderboard (lowest score wins):
10
#181 - 六弦 / @liuxian1990

06/05/2020 at 12:29PM

10
#182 - Rene Ribaud / @Uggla_

06/07/2020 at 09:24PM

10
#183 - Adam Hartz / @awareofnow

06/08/2020 at 02:02AM

10
#184 - Simon Wydooghe / @simonwydooghe

06/09/2020 at 09:09PM

10
#185 - Eric Chapdelaine / @Emchap44

06/09/2020 at 10:03PM

10
#186 - Hogo / @HogoBlog

06/10/2020 at 01:29PM

10
#187 - Dan / @DanSharkey88

06/12/2020 at 12:37AM

10
#188 - Jake / @Jake88567157

06/12/2020 at 11:02AM

10
#189 - Alex Lucchesi / @suarigata

06/12/2020 at 01:55PM

10
#190 - pspencil / @pspencil

06/13/2020 at 02:18PM

10
#191 - Micael Jarniac / @MicaelJarniac

06/14/2020 at 12:56AM

10
#192 - smlbrngr / @smlbrngr

06/15/2020 at 10:25AM

10
#193 - Chris AtLee / @chrisatlee

06/15/2020 at 10:03PM

10
#194 - Reynald Havard / @rey_ha

06/15/2020 at 11:05PM

10
#195 - kujbika / @kujbika

06/16/2020 at 08:50AM

10
#196 - JimmyGymglish / @JGymglish

06/18/2020 at 10:42AM

10
#197 - Amit Shah / @Amwam

06/19/2020 at 08:41AM

10
#198 - vimgolfo / @vimgolfo

06/19/2020 at 08:54PM

10
#199 - kcalbnodrog / @kcalbnodrog

06/19/2020 at 09:45PM

10
#200 - Chicuella / @chicuellahere

06/19/2020 at 10:56PM

10
#201 - もりを / @morio_prog

06/20/2020 at 03:15AM

10
#202 - Matthew Diamant / @matthewdiamant

06/20/2020 at 07:37AM

10
#203 - Karol Łukaszewicz / @Karolukaszewicz

06/23/2020 at 10:37AM

10
#204 - Ben White / @biwhite

06/23/2020 at 08:39PM

10
#205 - James Lowry / @jlowry

06/26/2020 at 10:45AM

10
#206 - Dan / @nnmnsmmr

06/27/2020 at 04:23PM

10
#207 - Zhuo Zhang / @i2huer

06/28/2020 at 01:47AM

10
#208 - 薛乾明 / @xueqianming200

06/28/2020 at 05:55AM

10
#209 - 大矢元海 / @008Genkai

06/28/2020 at 06:48PM

10
#210 - Arvid Lunnemark / @ArVID220u

06/28/2020 at 07:43PM