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

1174 active golfers, 4856 entries

Leaderboard (lowest score wins):
10
#121 - MPDR / @MPDR200011

05/05/2020 at 02:04PM

10
#122 - Slava Gachkaylo / @slavyan

05/05/2020 at 03:52PM

10
#123 - Pawel Wenda / @pwlwnd

05/05/2020 at 09:16PM

10
#124 - Bspammer / @Bspammer

05/06/2020 at 11:50PM

10
#125 - Quentin Leroy / @qnleroy

05/07/2020 at 01:56PM

10
#126 - Anay Karnik / @anay_karnik

05/08/2020 at 11:38AM

10
#127 - Chen Ting Huang / @ChenTingHuang1

05/09/2020 at 08:05AM

10
#128 - Андриянов Роман / @angeldeath29

05/10/2020 at 02:50PM

10
#129 - Greg Jebb / @jebbster

05/10/2020 at 09:09PM

10
#130 - Stefan Richter / @r1chter19

05/10/2020 at 10:47PM

10
#131 - Mateo / @Mateo_BCN

05/11/2020 at 07:21PM

10
#132 - Pan / @bekindtopeople2

05/11/2020 at 09:47PM

10
#133 - thejojo87 / @thejojo1987

05/11/2020 at 10:14PM

10
#134 - Antoine Pietri / @seirl_

05/12/2020 at 08:35AM

10
#135 - Joel / @Joel33380735

05/14/2020 at 02:25PM

10
#136 - Kevin Keefe / @KevinKeefe5

05/14/2020 at 05:35PM

10
#137 - Jake Van Alstyne / @jake_va

05/14/2020 at 06:29PM

10
#138 - Derrick Anderson - Solstice / @DerrickSolstice

05/14/2020 at 08:51PM

10
#139 - Bhargav Makwana / @I_aM_Bhargav

05/15/2020 at 07:36AM

10
#140 - Joel / @JoelRepta

05/15/2020 at 06:25PM

10
#141 - Caught Red Handed / @eseprimo

05/16/2020 at 05:40PM

10
#142 - dani0854 / @dani08541

05/16/2020 at 09:36PM

10
#143 - Pham Tuan Anh / @anhpt379

05/17/2020 at 04:36PM

10
#144 - Jonáš Šerých / @serycjon

05/18/2020 at 01:43PM

10
#145 - Andreas Buhr / @andreas_buhr

05/19/2020 at 02:13PM

10
#146 - 于吉星 / @fishermryn

05/21/2020 at 11:00AM

10
#147 - lpf / @yurisses

05/21/2020 at 05:10PM

10
#148 - Christophe Robillard / @krichtof

05/21/2020 at 06:11PM

10
#149 - Wayne / @lilwayne15561

05/22/2020 at 02:01AM

10
#150 - kim88 / @hashascii88

05/22/2020 at 07:45AM