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 350 remaining solutions by signing in and submitting your own entry
#351 陈石峰 / @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

351 active golfers, 1432 entries

Leaderboard (lowest score wins):
31
#151 - Tom11w / @Tom11Wh

04/22/2022 at 06:02PM

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

04/22/2022 at 06:13PM

31
#153 - fuckscuthenrunaway / @mir0sun

04/23/2022 at 01:03PM

31
#154 - NicolasWebDev / @NicolasWebDev

04/28/2022 at 03:03AM

31
#155 - Ed Allison / @eallison1102

05/14/2022 at 09:51PM

31
#156 - Calum Smith / @cpmsmith

05/27/2022 at 11:08PM

31
#157 - Will Long / @WillLon30283972

06/17/2022 at 02:07PM

31
#158 - yann / @ylsarto

06/20/2022 at 06:18AM

31
#159 - Ariel Frischer / @ArielFrischer

06/26/2022 at 07:56PM

31
#160 - Joey E / @GigachadJoe

07/18/2022 at 11:55PM

31
#161 - Yannick / @Yannick88147038

07/19/2022 at 07:18PM

31
#162 - Omar Alawadhi / @OmarAla59544225

09/10/2022 at 10:18PM

31
#163 - Andrew Liu / @AndrewL45936893

09/19/2022 at 04:13AM

32
#164 - 盧小小 / @VegetaLu

04/01/2022 at 03:35PM

32
#165 - Macunaíma / @Macunama11

05/06/2022 at 03:27PM

32
#166 - laityjet / @laityjet1

05/08/2022 at 02:45PM

32
#167 - Tim / @MarhjaKhazua

05/14/2022 at 09:35AM

32
#168 - K Br / @KBr20097882

09/05/2022 at 09:55PM

32
#169 - Connor / @ronnocthered

11/12/2022 at 03:25AM

33
#170 - Graham Bates / @gigabates

04/12/2022 at 05:34PM

33
#171 - 이승찬 / @Tmc9kvp7woF9x0F

04/17/2022 at 01:47PM

33
#172 - Megan Niu / @MeganNiu

06/25/2022 at 04:40PM

33
#173 - Robin / @donpavlas

07/09/2022 at 04:38PM

33
#174 - Aarya / @aaryabhatia6

07/15/2022 at 03:42AM

33
#175 - Sarang Khim / @sarang_khim

07/27/2022 at 08:53AM

33
#176 - Brandon / @Brandon10678836

10/16/2022 at 02:26PM

34
#177 - Максим Инп / @InpMaksim

05/07/2022 at 02:40PM

34
#178 - Golfer / @Golfer56598542

06/24/2022 at 11:17AM

34
#179 - Tanguy Defer / @TanguyDefer

07/06/2022 at 03:34PM

34
#180 - Kim Hunter / @bigkm

08/02/2022 at 04:15AM