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

1361 active golfers, 5597 entries

Leaderboard (lowest score wins):
11
#511 - Juan Manuel Fresia / @fresiajm

06/12/2020 at 07:43PM

11
#512 - nihilistCookie / @NihilistCookie

06/13/2020 at 07:39AM

11
#513 - khedd / @sinan_khedd

06/13/2020 at 05:15PM

11
#514 - dg_ / @l_o_s_o_s

06/14/2020 at 11:48AM

11
#515 - f / @f68602163

06/14/2020 at 04:29PM

11
#516 - dirkrob / @dirkrob1

06/18/2020 at 03:54AM

11
#517 - lqkem3 / @lqkem31

06/19/2020 at 04:54AM

11
#518 - vimRunnerUp3000 / @VUp3000

06/19/2020 at 01:53PM

11
#519 - ithirty / @ithirty4

06/22/2020 at 04:58PM

11
#520 - Khoyobegenn / @Khoyobegenn

06/24/2020 at 08:55AM

11
#521 - Yuri G. / @SincereEcho

06/24/2020 at 11:44AM

11
#522 - Will / @WillTakeLe

06/25/2020 at 05:09AM

11
#523 - bichoverde / @bichoverde5

06/25/2020 at 09:05AM

11
#524 - example_user_1032452 / @E1032452

06/25/2020 at 05:45PM

11
#525 - mocihan / @mocihan

06/26/2020 at 04:49AM

11
#526 - Francesco De Rose / @fdierre

06/26/2020 at 09:01PM

11
#527 - Jan van Veldhuizen / @grandasmurfo

06/27/2020 at 01:40PM

11
#528 - PL970 / @PraecorLoth970

06/28/2020 at 07:51PM

11
#529 - cwaldbieser / @cwaldbieser

06/28/2020 at 10:38PM

11
#530 - Imer Chavez / @imer_chavez

06/29/2020 at 11:59PM

11
#531 - Mitchell Horning / @HorningMitchell

06/30/2020 at 04:24PM

11
#532 - JLObject / @powful_panda

07/01/2020 at 12:57AM

11
#533 - Joe Cabezas / @JoeCabezas

07/01/2020 at 03:05AM

11
#534 - Felipe / @f1ipps

07/01/2020 at 07:02AM

11
#535 - Alexandre MERLIN / @AlxMerlin

07/02/2020 at 02:03PM

11
#536 - Ron-Shan,Chang / @highlupin

07/03/2020 at 02:54AM

11
#537 - Reuben Narkwo / @reubwo

07/03/2020 at 12:21PM

11
#538 - Jack Garrard / @speyejack

07/05/2020 at 01:04AM

11
#539 - Ivo Blöchliger / @aigledesalpes

07/06/2020 at 07:20PM

11
#540 - rl5day / @rl5day

07/07/2020 at 03:40AM