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

1427 active golfers, 5800 entries

Leaderboard (lowest score wins):
11
#661 - Barabas Raffai / @BarabasRaffai

12/25/2020 at 08:39PM

11
#662 - Jung Yeon Park / @park_jungy

12/27/2020 at 07:36PM

11
#663 - Björn Struckmeier / @BjrnStruckmeie1

01/02/2021 at 12:24PM

11
#664 - slen / @slen97472206

01/03/2021 at 11:38PM

11
#665 - pady. 🇪🇺 / @hundertzwoelf_

01/08/2021 at 03:03PM

11
#666 - this is for vim golf / @Dis4VimGolf

01/12/2021 at 11:20PM

11
#667 - kafang plays vimgolf / @KafangV

01/13/2021 at 08:05AM

11
#668 - 김범준 / @kmbmjn

01/13/2021 at 12:42PM

11
#669 - gimmie fromage / @FromageGimmie

01/14/2021 at 02:19PM

11
#670 - Yuhan Chen / @YuhanCh06219951

01/14/2021 at 11:36PM

11
#671 - JingChen / @ilovejingle

01/18/2021 at 05:11AM

11
#672 - BumfuzzleGames / @BumfuzzleGames

01/18/2021 at 08:29AM

11
#673 - Dave Millican / @dave_millican

01/18/2021 at 09:41AM

11
#674 - Horst / @Horst91706815

01/18/2021 at 06:21PM

11
#675 - Ken Baldwin / @kenbald1

01/19/2021 at 04:29AM

11
#676 - S / @steed2005

01/19/2021 at 02:12PM

11
#677 - Xiao Wangwang / @WangwangXiao

01/19/2021 at 05:55PM

11
#678 - Adam Katz / @AdamKat40357638

01/20/2021 at 12:10PM

11
#679 - Richard Leigh Davies / @RichardDaviesAI

01/23/2021 at 02:27PM

11
#680 - OtterPy / @OtterPy

01/26/2021 at 02:28PM

11
#681 - Askhento / @Askhento1

01/27/2021 at 07:22PM

11
#682 - Fabrice BONNET / @FabriceBONNET6

04/29/2021 at 03:19PM

11
#683 - xing yang / @yangxing844

05/09/2021 at 03:40PM

11
#684 - huscarl / @huscarl6

05/20/2021 at 03:07PM

11
#685 - Yttriferous / @YttriferousDev

05/25/2021 at 08:38AM

11
#686 - vim_maxter / @MaxterVim

07/01/2021 at 08:59AM

11
#687 - Matrices Matlab #1 / @matrices_matlab

07/14/2021 at 11:24AM

12
#688 - Jan Bundesmann / @janbundesmann

02/20/2020 at 11:40AM

12
#689 - mnx / @mnxx

02/20/2020 at 10:06PM

12
#690 - Michael / @thscuriousquest

02/21/2020 at 03:55AM