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
#211 - Mark / @Mark45346316

06/28/2020 at 07:48PM

10
#212 - Dheepak Krishnamurthy / @kdk_t

06/29/2020 at 06:13AM

10
#213 - Apox / @apox159

06/29/2020 at 09:35PM

10
#214 - Ming Dai / @MingDai2

06/29/2020 at 11:21PM

10
#215 - Mario Olofo / @mario_olofo

06/30/2020 at 12:18PM

10
#216 - Florent (Flomyx) 🇧🇪🇧🇪 / @SinergyTv

06/30/2020 at 12:18PM

10
#217 - Duggan / @CallMeDuggan

07/01/2020 at 03:27PM

10
#218 - Jan Sturm / @JanSturm77

07/02/2020 at 05:37PM

10
#219 - Jon Krause / @jkrause314

07/03/2020 at 03:08AM

10
#220 - HiJova / @Jova28190268

07/03/2020 at 12:01PM

10
#221 - PeiYingLiu / @PeiYing_Liu

07/03/2020 at 02:30PM

10
#222 - Brennan Barker / @BrennanJBarker

07/03/2020 at 09:42PM

10
#223 - Victorien ELVINGER / @Conaclos

07/04/2020 at 12:03PM

10
#224 - cdan / @cdan

07/06/2020 at 09:35AM

10
#225 - Lucas Moon / @LucasMo01299826

07/06/2020 at 02:19PM

10
#226 - Ángel Durán / @AngeeelD

07/07/2020 at 08:29PM

10
#227 - SardarJitensha / @SJitensha

07/08/2020 at 12:01PM

10
#228 - Loric Brevet / @lobre8

07/08/2020 at 12:27PM

10
#229 - PK / @pkeugine

07/10/2020 at 05:12AM

10
#230 - Виталий Макаров / @avada_keda_bra

07/12/2020 at 09:34PM

10
#231 - analogpixel / @analogp1xel

07/13/2020 at 04:42PM

10
#232 - Dmitry Branitskiy / @b1azer

07/14/2020 at 04:28AM

10
#233 - ippachi / @ippachi1018

07/14/2020 at 09:45AM

10
#234 - Torstein Ørbeck Eliassen / @torsteoe

07/15/2020 at 08:12PM

10
#235 - Eric Link / @elink_tx

07/16/2020 at 03:44AM

10
#236 - Jonathan / @jonathannerat

07/17/2020 at 02:14PM

10
#237 - Artur Dumchev / @Liverm0r

07/18/2020 at 07:22PM

10
#238 - JL T / @l0f4r0

07/19/2020 at 05:23PM

10
#239 - Erim Secla / @Alcesmire

07/21/2020 at 08:27PM

10
#240 - Andy Yang / @yzwdroid

07/24/2020 at 04:10PM