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
#241 - knub / @LauraToric

07/25/2020 at 12:36PM

10
#242 - Kurtis D. Miller / @phdkurt

07/26/2020 at 12:13AM

10
#243 - Steve Frost / @FrostSteveFrost

07/27/2020 at 02:43AM

10
#244 - Gergely Risko / @errge

07/28/2020 at 07:39PM

10
#245 - Till Straube / @tillstr

07/29/2020 at 11:14AM

10
#246 - Xaver Fleer / @XaverFleer

07/29/2020 at 08:52PM

10
#247 - Olle Wiklund / @Kabix

07/30/2020 at 01:07PM

10
#248 - Sina Siadat / @sinasiadat

07/30/2020 at 01:38PM

10
#249 - spock900 / @spock9002

08/02/2020 at 01:46AM

10
#250 - Denis / @4NNTGudvin

08/05/2020 at 01:17PM

10
#251 - Du Phan / @fehiepsi

08/05/2020 at 06:04PM

10
#252 - mindgitrwx / @mindgitrwx

08/06/2020 at 02:03PM

10
#253 - Tanzeel Kazi / @tanzeelkazi

08/06/2020 at 05:56PM

10
#254 - Nicolas Marier / @NicMarier

08/06/2020 at 10:13PM

10
#255 - Lakshitha Wijesinghe / @lakshithaww

08/07/2020 at 11:41AM

10
#256 - haipeng li / @HaipengLie

08/08/2020 at 01:37PM

10
#257 - Alexander L. / @Lexol4s

08/11/2020 at 05:15PM

10
#258 - Marco Selvi / @macselvi

08/14/2020 at 05:34PM

10
#259 - Cao Van Bi / @CaoVanBi235

08/15/2020 at 05:16AM

10
#260 - platypusDancing / @platypusDancing

08/16/2020 at 02:57AM

10
#261 - Андрей / @appomsk

08/16/2020 at 07:01AM

10
#262 - Ihor / @Ihor96382508

08/16/2020 at 02:24PM

10
#263 - Cat's Face / @CatsFace2

08/19/2020 at 10:30AM

10
#264 - Theo Sarrazin / @tshaero

08/20/2020 at 06:39AM

10
#265 - Łukasz Kadłubowski / @LAKadlubowski

08/20/2020 at 08:12PM

10
#266 - Champii Akronym / @ChampiiPwet

08/21/2020 at 11:30AM

10
#267 - Stewart Martin / @aspace_au

08/23/2020 at 03:19AM

10
#268 - Bajok / @b410k

08/24/2020 at 10:24PM

10
#269 - Matthew Blode / @BlodeMatthew

08/25/2020 at 10:59AM

10
#270 - lz2ggf / @lz2ggf

08/25/2020 at 06:19PM