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

1182 active golfers, 4881 entries

Leaderboard (lowest score wins):
11
#481 - Alexandre MERLIN / @AlxMerlin

07/02/2020 at 02:03PM

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

07/03/2020 at 02:54AM

11
#483 - Reuben Narkwo / @reubwo

07/03/2020 at 12:21PM

11
#484 - Jack Garrard / @speyejack

07/05/2020 at 01:04AM

11
#485 - Ivo Blöchliger / @aigledesalpes

07/06/2020 at 07:20PM

11
#486 - rl5day / @rl5day

07/07/2020 at 03:40AM

11
#487 - Ilker Mutlu / @ilkermutlu

07/09/2020 at 10:30AM

11
#488 - Gabe Pohl-Zaretsky / @Gabe_PZ

07/10/2020 at 04:52PM

11
#489 - jackmark / @jackmar14540583

07/11/2020 at 05:40AM

11
#490 - Adrián Delgado / @Caritativito

07/11/2020 at 10:49PM

11
#491 - Vital Wang / @wang_vital

07/12/2020 at 05:12PM

11
#492 - Dane Summers / @dsummersl

07/12/2020 at 06:34PM

11
#493 - dadav 🥀 / @__dadav__

07/15/2020 at 07:44PM

11
#494 - Julien Duc / @jduc_0

07/16/2020 at 08:43AM

11
#495 - Chester Yap / @Chest_ErYap

07/16/2020 at 06:41PM

11
#496 - matteo / @matteo55169132

07/17/2020 at 10:41PM

11
#497 - Saurabh / @Saurabh09299

07/21/2020 at 08:40AM

11
#498 - John Galt / @JohnGalt24

07/21/2020 at 03:27PM

11
#499 - Jason / @jason_eveleth

07/22/2020 at 12:15PM

11
#500 - Rasmus P / @rasmup

07/24/2020 at 04:29PM

11
#501 - kok / @kok89428331

07/25/2020 at 06:33AM

11
#502 - Kim Bäckström / @Norttiiii

07/25/2020 at 08:18AM

11
#503 - Norman Liu / @normanwliu

07/25/2020 at 10:32PM

11
#504 - Josh Kermond / @Kermond

07/27/2020 at 03:10AM

11
#505 - GenericHardwareGamer / @GnrikHrdwrGamer

08/04/2020 at 09:22AM

11
#506 - David Martínez / @g0ddrinksjava

08/07/2020 at 08:11PM

11
#507 - Kazuki / @algo__n

08/08/2020 at 03:33PM

11
#508 - Vinay Sharma / @VinaySh63956554

08/08/2020 at 04:03PM

11
#509 - Martin Bielik / @mabielik

08/09/2020 at 08:43PM

11
#510 - human13 / @human0013

08/12/2020 at 09:54PM