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

1542 active golfers, 6323 entries

Leaderboard (lowest score wins):
10
#451 - Neix20 / @Neix20

09/30/2024 at 01:32AM

10
#452 - Demian Martinez / @demianuco

11/22/2024 at 08:15AM

10
#453 - Magnus Wahlstrand / @magnuswahlstrand

12/27/2024 at 03:46PM

10
#454 - martinorav / @martinorav

01/23/2025 at 01:53PM

11
#455 - Norbert / @mullno

02/20/2020 at 06:13AM

11
#456 - None / @sh1chuang

02/20/2020 at 10:44AM

11
#457 - Miko / @_m_ik_o_

02/20/2020 at 04:17PM

11
#458 - Jason Neylon / @jasonneylon

02/20/2020 at 10:07PM

11
#459 - tomo@D2S / @e_2_718281828

02/21/2020 at 02:34AM

11
#460 - Arijus / @argshook

02/21/2020 at 02:20PM

11
#461 - Gytis Vinclovas / @GytisVinclovas

02/21/2020 at 02:26PM

11
#462 - Bitt Faulk / @bittfaulk

02/21/2020 at 04:23PM

11
#463 - Alvaro Melendez / @alvaromelendezh

02/21/2020 at 04:31PM

11
#464 - Bradley Pankow / @BTPankow

02/21/2020 at 08:44PM

11
#465 - Strages / @Strages2k

02/22/2020 at 06:59PM

11
#466 - Luan / @imediativo

02/22/2020 at 10:02PM

11
#467 - Franckdemda / @Franckdemda

02/22/2020 at 11:26PM

11
#468 - garry quested / @GQuested

02/24/2020 at 03:26PM

11
#469 - hwnd / @harlinwt

02/24/2020 at 07:36PM

11
#470 - perTheGolfer / @GolferPer

02/25/2020 at 07:14AM

11
#471 - KingYames / @JamesZeHunter

02/25/2020 at 12:32PM

11
#472 - jake / @eyes_low

02/26/2020 at 12:47AM

11
#473 - Filipe Brandenburger / @filbranden

02/28/2020 at 11:52PM

11
#474 - tPenguinLTG / @tpenguinltg

02/29/2020 at 03:37PM

11
#475 - Alexander Bessonov / @nonsleepr

03/02/2020 at 02:00PM

11
#476 - Robin / @donpavlas

03/03/2020 at 11:39AM

11
#477 - James Rayman / @jamsramen

03/04/2020 at 07:33PM

11
#478 - Victor Chen / @VictorC36685615

03/05/2020 at 06:45PM

11
#479 - Robert Mosher / @rcmosher

03/05/2020 at 06:50PM

11
#480 - Piotr Grzegorski / @PGrzegorski

03/06/2020 at 12:24PM