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):
19
#1141 - Marcos Filho / @malbertoifi

11/05/2020 at 06:48PM

19
#1142 - Matt Milliron / @valueiron

11/27/2020 at 09:48AM

19
#1143 - Gabe / @Gabe74053768

12/10/2020 at 02:09PM

19
#1144 - Bharath / @Bharath15952517

12/12/2020 at 05:53PM

19
#1145 - Oscar Bailey / @oscarb_xyz

12/16/2020 at 12:53PM

19
#1146 - altamente / @altamnt

12/17/2020 at 10:59AM

19
#1147 - Kapildev Neupane / @KapildevNeupane

12/29/2020 at 03:13AM

19
#1148 - Simon Lang / @veryuniqueaccou

01/06/2021 at 05:56AM

19
#1149 - soppeldynga / @soppeldynga

01/09/2021 at 07:59PM

19
#1150 - Caleb Biddulph / @BiddulphCaleb

01/27/2021 at 02:20AM

19
#1151 - BenMedcalf / @BMedcalf_online

04/17/2021 at 02:47AM

20
#1152 - phe / @phelipetls

02/27/2020 at 02:45AM

20
#1153 - Laurent Atlan / @laurentatlan1

03/03/2020 at 07:46PM

20
#1154 - Тёма / @Timon_Surikat

03/04/2020 at 01:11PM

20
#1155 - Ishi / @HalloWard1

03/08/2020 at 09:39AM

20
#1156 - Andrew Farries / @surjection123

03/19/2020 at 02:36PM

20
#1157 - Nguyen Van Bac / @taybacvt

03/20/2020 at 03:54PM

20
#1158 - Joe Farnsworth / @JoeFarnsworth

03/23/2020 at 01:16AM

20
#1159 - ぬるー / @_Nururin

03/24/2020 at 05:49AM

20
#1160 - antipattern / @antipattern5

03/28/2020 at 09:44PM

20
#1161 - Novsirion / @novsirion

03/30/2020 at 01:56PM

20
#1162 - Atzz / @AtzzCokeK

04/05/2020 at 09:30AM

20
#1163 - Кунин Александр / @skyksandr

04/16/2020 at 04:47PM

20
#1164 - iobtl / @iobtl2

04/18/2020 at 09:02AM

20
#1165 - Francsico / @Francsi31459977

04/18/2020 at 01:02PM

20
#1166 - sabinmaharjan40@gmail.com / @sabinmaharjan40

04/19/2020 at 07:42AM

20
#1167 - Sabrina Seibel / @seibelsabrina

04/21/2020 at 04:23AM

20
#1168 - YTREWQ / @userytrewq

04/23/2020 at 01:00AM

20
#1169 - Robin Abrahamsson / @rqAbrahamsson

04/29/2020 at 10:57AM

20
#1170 - john / @john99857791

05/07/2020 at 01:47AM