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 9v006233d72d000000000219

Fix the shell script!

Fix the shell script with the fewest keystrokes!

Start file
#!/bin/bash
a = 5
b = 10
sum = $a + $b
echo $sum

mul = $a * $b
echo $mul
End file
#!/bin/bash
a=5
b=10
sum=$((a + b))
echo $sum

mul=$((a * b))
echo $mul

View Diff

2,4c2,4
< a = 5
< b = 10
< sum = $a + $b
---
> a=5
> b=10
> sum=$((a + b))
7c7
< mul = $a * $b
---
> mul=$((a * b))

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 590 remaining solutions by signing in and submitting your own entry
#591 陈石峰 / @lazycode1226 - Score: 246 - 10/10/22 @ 06:45
jjkkjjkkjo<Esc>dujkkjuujjkjjjjk:s<BS>ss<BS><BS>s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>%s/s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>=<BS> = =<BS>/s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>=/g<CR>:4,7s<BS>s<BS>s<BS>s/s<BS>s<BS>s<BS>s<BS>s<BS>s<BS>$a/s<BS>s<BS>((<BS><BS>\<BS>((/g<BS><BS>a/g<CR>:<Up><Left><Left><Left><Left><Left><Left><BS>b<Right><Right><Right><Right><Right><Right><Left><Left><Left><BS><BS><Right><BS>b))<CR>:.<BS>s<BS>s<BS><Up><Left><Right><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>s<BS>s<BS>s/((<BS>/<BS>/<BS><BS>/<BS>(<Left>\<Right>/<BS><BS><BS>(/<BS>(/$((/g<CR>qq<Esc><0xef><0xbc><0x9a><0xef><0xbc><0x9a><Esc>sk<Esc>ukjZZ

0 comments


Created by: @u_hossein

591 active golfers, 2546 entries

Leaderboard (lowest score wins):
30
#241 - Don'tBeAlarmed / @DontBeAlarmed

06/01/2024 at 07:13PM

30
#242 - Christopher Arausa | Rathma / @wrathofrathma

08/28/2024 at 08:53PM

31
#243 - Aiden Yang / @aidenyangnn

03/18/2022 at 03:08AM

31
#244 - h / @tgen22334

03/18/2022 at 08:55AM

31
#245 - Richard Smith / @appsmithuk

03/19/2022 at 01:50AM

31
#246 - Andreas Aumann / @andreasaumann

03/20/2022 at 04:16PM

31
#247 - Pawel Wenda / @pwlwnd

03/27/2022 at 08:09PM

31
#248 - dorianm / @dorianm

03/28/2022 at 03:51AM

31
#249 - rnakai / @rnakai_42

03/30/2022 at 08:17AM

31
#250 - Ansuman Bardalai / @abardalai

04/11/2022 at 06:49AM

31
#251 - Johnnie Walker / @Johnnie11414500

04/11/2022 at 02:00PM

31
#252 - 그안합 / @asm6788_kor

04/15/2022 at 02:17PM

31
#253 - Tom11w / @Tom11Wh

04/22/2022 at 06:02PM

31
#254 - Preston Pysh܁ᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠ / @Gordan6freeman

04/22/2022 at 06:13PM

31
#255 - fuckscuthenrunaway / @mir0sun

04/23/2022 at 01:03PM

31
#256 - NicolasWebDev / @NicolasWebDev

04/28/2022 at 03:03AM

31
#257 - Ed Allison / @eallison1102

05/14/2022 at 09:51PM

31
#258 - Calum Smith / @cpmsmith

05/27/2022 at 11:08PM

31
#259 - Will Long / @WillLon30283972

06/17/2022 at 02:07PM

31
#260 - yann / @ylsarto

06/20/2022 at 06:18AM

31
#261 - Ariel Frischer / @ArielFrischer

06/26/2022 at 07:56PM

31
#262 - Joey E / @GigachadJoe

07/18/2022 at 11:55PM

31
#263 - Yannick / @Yannick88147038

07/19/2022 at 07:18PM

31
#264 - Omar Alawadhi / @OmarAla59544225

09/10/2022 at 10:18PM

31
#265 - Andrew Liu / @AndrewL45936893

09/19/2022 at 04:13AM

31
#266 - Nicholas Healy / @nickrhealy

12/18/2022 at 02:57PM

31
#267 - zoomhauer / @paulonhere

11/25/2023 at 09:55PM

31
#268 - Frédéric Heulin / @talineo

12/07/2023 at 11:16PM

31
#269 - ysw505 / @ysw505

01/14/2024 at 10:33AM

31
#270 - justgamer248 / @justgamer248

04/11/2024 at 10:47AM