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

1434 active golfers, 5829 entries

Leaderboard (lowest score wins):
15
#901 - Carsano / @DamienFbn

10/09/2020 at 02:34PM

15
#902 - R1 Bwre / @Erw_Bi

10/10/2020 at 03:30PM

15
#903 - Asbjørn Riddervold / @ARiddervold

10/11/2020 at 05:22PM

15
#904 - hhh / @hhh78116797

10/17/2020 at 12:17PM

15
#905 - Matti Sairanen / @MattiSairanen

10/27/2020 at 10:29PM

15
#906 - Tobias Eliasson / @arnestig

11/11/2020 at 09:06AM

15
#907 - Leander Hendrikx / @leanderhendrikx

11/19/2020 at 01:24PM

15
#908 - Manas / @weirdsmiley_

11/23/2020 at 07:32PM

15
#909 - background extra in a nightmare / @56khole

12/08/2020 at 10:18PM

15
#910 - jirgn / @jirgn

12/10/2020 at 09:44PM

15
#911 - 영훈 / @odjfnrtm

12/15/2020 at 12:43AM

15
#912 - Rafael B. / @rafib

12/24/2020 at 02:01PM

15
#913 - pong / @mr_pongpong

12/27/2020 at 10:55PM

15
#914 - い / @_7iva

12/30/2020 at 07:33PM

15
#915 - lkmsf / @lkmsf2

01/02/2021 at 02:59AM

15
#916 - SpadeAcademic / @AcademicSpade

01/12/2021 at 10:19AM

15
#917 - Axel Dahlberg / @AxelDahlberg1

02/12/2021 at 01:28PM

15
#918 - joao neto / @joaonet49907796

05/14/2021 at 08:30PM

15
#919 - Rory Smith / @alan0buchanan

09/19/2021 at 11:54AM

16
#920 - Marius Jurgelenas / @MarenasLT

02/21/2020 at 02:14PM

16
#921 - FormigTeen / @FormigTeen

02/21/2020 at 02:44PM

16
#922 - Charlie OConor / @charlieoconor

02/21/2020 at 05:34PM

16
#923 - LinusPoutine / @LinusPoutine

02/26/2020 at 12:09PM

16
#924 - Muhammad Affan / @maqur5

03/04/2020 at 01:07PM

16
#925 - Jon Ohrt / @jammasterjon

03/08/2020 at 05:53PM

16
#926 - Rick Sperko / @rsperko

03/11/2020 at 12:40PM

16
#927 - Cookie4D / @Cookie4D1

03/11/2020 at 03:52PM

16
#928 - Niv / @SkuenD

03/13/2020 at 03:08PM

16
#929 - noremac / @noremac66873702

03/14/2020 at 09:22AM

16
#930 - bruno cunha / @bruncun

03/15/2020 at 02:00AM