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

1085 active golfers, 4501 entries

Leaderboard (lowest score wins):
11
#331 - Robin / @donpavlas

03/03/2020 at 11:39AM

11
#332 - James Rayman / @jamsramen

03/04/2020 at 07:33PM

11
#333 - Victor Chen / @VictorC36685615

03/05/2020 at 06:45PM

11
#334 - Robert Mosher / @rcmosher

03/05/2020 at 06:50PM

11
#335 - Piotr Grzegorski / @PGrzegorski

03/06/2020 at 12:24PM

11
#336 - vtls / @vtls16

03/07/2020 at 06:07AM

11
#337 - Fernando Serboncini / @fserb

03/07/2020 at 04:05PM

11
#338 - José / @AngelGaldamez

03/08/2020 at 02:24AM

11
#339 - drudd / @drudd

03/08/2020 at 03:19AM

11
#340 - Alexander Brömmer / @Superbort

03/08/2020 at 05:14PM

11
#341 - Guillaume Vigeant / @GVigeant

03/09/2020 at 06:56PM

11
#342 - Jonghyun Yun / @JonghyunYun

03/09/2020 at 08:59PM

11
#343 - Brian Lause / @TallBrianL

03/12/2020 at 03:01AM

11
#344 - Nguyen Hung / @Ikazuchi16

03/13/2020 at 06:44AM

11
#345 - Khalid Harun / @KhalidHarun

03/14/2020 at 03:26AM

11
#346 - Md Saif / @saif47

03/14/2020 at 08:29AM

11
#347 - Paul Inc / @hiniol1982

03/15/2020 at 08:24PM

11
#348 - Edan Sneh / @edan_sneh

03/17/2020 at 06:29AM

11
#349 - vvaannaa3 / @vvaannaa3

03/17/2020 at 03:25PM

11
#350 - Under Blown / @iovuio

03/18/2020 at 04:05AM

11
#351 - Caique Santana / @_caique39

03/20/2020 at 03:17AM

11
#352 - Roger Stoltz / @rogsto1

03/20/2020 at 10:36PM

11
#353 - Osama Abdelsatar / @Osa_ahlawy

03/21/2020 at 10:45PM

11
#354 - Rodrigo V. Lopes / @rodvlopes

03/22/2020 at 07:03PM

11
#355 - Quark / @PuzzleQuark

03/22/2020 at 07:27PM

11
#356 - Global Maquereau / @GlobalMaquereau

03/23/2020 at 06:40AM

11
#357 - Costel Radulescu / @_wizard_

03/23/2020 at 10:42PM

11
#358 - agricantare / @agricantare

03/25/2020 at 06:46AM

11
#359 - BartJanssen / @BartJanssen

03/25/2020 at 08:40AM

11
#360 - eshel / @EshelBM

03/25/2020 at 07:06PM