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

1182 active golfers, 4881 entries

Leaderboard (lowest score wins):
10
#301 - Sébastien Roccaserra / @sroccaserra

09/24/2020 at 08:22PM

10
#302 - Ivan Kwong / @IvanKwong5

09/26/2020 at 09:35AM

10
#303 - Alice / @Alice92541388

09/27/2020 at 11:44PM

10
#304 - Lex Romanov / @feax_ru

09/28/2020 at 06:01AM

10
#305 - dotvimrc / @dotvimrc1

09/28/2020 at 06:40AM

10
#306 - Jan Liu / @Jagsomarjan

09/29/2020 at 04:09PM

10
#307 - João Carvalho / @joaoCarvas

09/29/2020 at 09:29PM

10
#308 - Michael Castelein / @ichael11

10/01/2020 at 01:19AM

10
#309 - Arend Peter / @APCastelein

10/01/2020 at 01:21AM

10
#310 - Chris Conte / @chriscconte

10/02/2020 at 04:05PM

10
#311 - Adrien Lemaire ドリ / @Adrien_Lemaire_

10/03/2020 at 08:25AM

10
#312 - alixwang / @wangjunal

10/03/2020 at 04:07PM

10
#313 - Gaganpreet / @_gagan

10/03/2020 at 10:28PM

10
#314 - Er St / @ErSt46286501

10/05/2020 at 06:15PM

10
#315 - Ashe Braum / @ashe_braum

10/06/2020 at 11:31AM

10
#316 - Ricardo Lima / @ricponteslima

10/06/2020 at 10:22PM

10
#317 - hi I'm anxious ✨ / @startresse

10/07/2020 at 01:53PM

10
#318 - Michael Bui / @Miik4chu

10/07/2020 at 02:19PM

10
#319 - Noisome Possum / @NoisomePossum

10/08/2020 at 08:39AM

10
#320 - Hristo Kamenov / @KamenovHristo

10/10/2020 at 12:37PM

10
#321 - DrHobo / @_DrHobo_

10/11/2020 at 12:01PM

10
#322 - Vladyslav Marsikov / @gagabogolo

10/12/2020 at 09:46AM

10
#323 - noam teyssier / @noamteyssier

10/15/2020 at 01:40AM

10
#324 - Dmitry Antonyuk / @AntonyukDmitry

10/15/2020 at 07:20AM

10
#325 - Cláudio Caseiro / @ccaseiro

10/16/2020 at 02:56AM

10
#326 - versa / @versa51547979

10/16/2020 at 07:13PM

10
#327 - Thanawat Yodnil / @littleboycoding

10/17/2020 at 09:47AM

10
#328 - Wickex / @Wickexx

10/18/2020 at 09:21AM

10
#329 - shallowbit / @shallowbit

10/19/2020 at 07:04AM

10
#330 - Aleks Kissinger / @AleksKissinger

10/19/2020 at 07:05AM