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):
10
#391 - Marion Oldman / @ThatBigCock

01/16/2021 at 11:55AM

10
#392 - notctsk / @notctsk

01/16/2021 at 01:52PM

10
#393 - Sergei Blinov / @awnion

01/17/2021 at 08:27AM

10
#394 - Michael / @linux478

01/18/2021 at 05:42PM

10
#395 - siruichang / @Blessing13Si

01/20/2021 at 08:43AM

10
#396 - Махмудов Физули / @neosat55

01/21/2021 at 05:47PM

10
#397 - wasighe / @wasighe

01/22/2021 at 11:00PM

10
#398 - 蔡徐坤真是爱吃屎 / @Hashub7

01/23/2021 at 01:47PM

10
#399 - Gaston / @Gaston53635525

01/23/2021 at 10:56PM

10
#400 - vimgolf / @vimgolf7

01/25/2021 at 01:57PM

10
#401 - Darrin Mourer / @dmourer

01/25/2021 at 04:08PM

10
#402 - Justin / @JustinVecchioni

01/25/2021 at 09:54PM

10
#403 - nedlog / @nedlog18

05/07/2021 at 08:04AM

10
#404 - Arya Kumar / @SusSquirrel

05/19/2021 at 01:44AM

10
#405 - sean choi / @joosting

06/03/2021 at 02:28AM

10
#406 - Patrick Martin / @PatrickDMartin

07/01/2021 at 07:43PM

10
#407 - logtxt / @logtxt1

07/04/2021 at 10:08AM

10
#408 - pikjes / @pikjes2

07/15/2021 at 12:24PM

10
#409 - lydxn / @lydxn1

07/29/2021 at 01:46AM

10
#410 - Roman Privalov / @RomanPrivalov

09/14/2021 at 03:38PM

10
#411 - yancy / @yancy_dong

09/17/2021 at 06:43AM

11
#412 - Norbert / @mullno

02/20/2020 at 06:13AM

11
#413 - None / @sh1chuang

02/20/2020 at 10:44AM

11
#414 - Miko / @_m_ik_o_

02/20/2020 at 04:17PM

11
#415 - Jason Neylon / @jasonneylon

02/20/2020 at 10:07PM

11
#416 - tomo@D2S / @e_2_718281828

02/21/2020 at 02:34AM

11
#417 - Arijus / @argshook

02/21/2020 at 02:20PM

11
#418 - Gytis Vinclovas / @GytisVinclovas

02/21/2020 at 02:26PM

11
#419 - Bitt Faulk / @bittfaulk

02/21/2020 at 04:23PM

11
#420 - Alvaro Melendez / @alvaromelendezh

02/21/2020 at 04:31PM