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

1421 active golfers, 5776 entries

Leaderboard (lowest score wins):
10
#361 - Noise Official / @zmunk19

11/24/2020 at 01:50PM

10
#362 - Trong Kha Nguyen / @__ngtrongkha

11/25/2020 at 02:57PM

10
#363 - nd183 / @nd1832

12/03/2020 at 07:47AM

10
#364 - Dax / @zacoxi

12/04/2020 at 07:59AM

10
#365 - Neverlandrunner / @neverlandrunner

12/05/2020 at 11:13AM

10
#366 - SEbbaDK / @SEbbaDK

12/06/2020 at 11:08AM

10
#367 - Ryan Way / @RyanWay16

12/08/2020 at 09:12PM

10
#368 - f a / @5eraf

12/12/2020 at 06:39AM

10
#369 - pherapont / @pherapont1

12/13/2020 at 05:11AM

10
#370 - Ian Burgan / @IanBurgan

12/14/2020 at 10:55PM

10
#371 - justinhj / @justinhj

12/16/2020 at 09:59PM

10
#372 - Jon Liang / @jon__liang

12/16/2020 at 10:00PM

10
#373 - nlfrocks / @nlfrocks

12/20/2020 at 07:20AM

10
#374 - jksnapp / @jksnapp2

12/21/2020 at 03:17AM

10
#375 - 김도현 / @pykJzzzsmAzloZl

12/21/2020 at 10:42AM

10
#376 - Niko Steinhoff / @niko_steinhoff

12/22/2020 at 06:22AM

10
#377 - niall / @subtractverb

12/22/2020 at 04:16PM

10
#378 - Zhenkai W. / @Zhenkai_W

12/24/2020 at 03:56AM

10
#379 - 임덕윤 / @SnLHUF5ZYJXqI1m

12/24/2020 at 08:13PM

10
#380 - Hachi / @hachi16777216

12/28/2020 at 05:22AM

10
#381 - Chenrui / @Chenrui15958704

12/29/2020 at 03:29AM

10
#382 - sh-wayz / @WayzSh

12/30/2020 at 03:13AM

10
#383 - Nicolas Pagny / @NicolasPagny

01/01/2021 at 11:40AM

10
#384 - Jon Miller / @jmillxyz

01/02/2021 at 03:49AM

10
#385 - Andac Safa / @SanDForcE94

01/03/2021 at 06:32AM

10
#386 - Ding Liu / @Nimrod0901

01/04/2021 at 02:06AM

10
#387 - 유승우 / @A0ynCXsO226uayI

01/04/2021 at 03:04AM

10
#388 - Duncan / @Duncan31503119

01/06/2021 at 03:34AM

10
#389 - A A A / @37fatos

01/06/2021 at 09:16PM

10
#390 - Gokul Raj / @Gokul_Raj__

01/14/2021 at 11:51AM