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):
41
#241 - xtncl / @xtncl

06/10/2022 at 08:43PM

41
#242 - Einn Seinn / @EinnSeinn

08/04/2022 at 02:25PM

41
#243 - Derek Salerno / @dsalernodev

12/01/2022 at 09:31PM

42
#244 - Richy Strnad / @RichardStrnad

03/19/2022 at 08:09PM

42
#245 - Quatrix / @Quatrix

04/08/2022 at 10:29PM

42
#246 - 梅 / @umetosawara

04/09/2022 at 08:04AM

42
#247 - タケ / @Take3832

04/17/2022 at 01:18PM

42
#248 - Eric Guo / @Euclideant

06/19/2022 at 11:42AM

42
#249 - Nathan Iszlaub / @NIszlaub

10/21/2022 at 05:51PM

43
#250 - onkeL / @onkeL_cs

03/19/2022 at 11:03PM

43
#251 - Michael Mior / @michaelmior

04/06/2022 at 07:51PM

43
#252 - 余超 / @SpicyChicken_yc

05/24/2022 at 03:11AM

43
#253 - averagebit / @averagebyte

10/03/2022 at 11:03AM

44
#254 - James Duffy / @jduffy3

04/08/2022 at 02:19AM

44
#255 - Enrique Santana / @esantanaya

04/24/2022 at 02:36AM

44
#256 - Carlos / @Karu75414928

06/04/2022 at 10:37AM

44
#257 - mika / @mika31120321

07/29/2022 at 06:27PM

44
#258 - Samantha / @Samantha_fga

10/13/2022 at 07:48AM

44
#259 - jimmarq / @jimmarq

10/27/2022 at 05:25PM

44
#260 - 成 / @Quanuanc

12/04/2022 at 01:09PM

45
#261 - Jovi  / @jovinh0_

05/08/2022 at 09:03AM

45
#262 - x03n046 / @x03n046

05/10/2022 at 02:39AM

45
#263 - Ammar Qaffaf / @AmmarQaffaf

05/19/2022 at 08:35PM

46
#264 - Julio C. Pompa Puente / @JCPompaPuente

03/18/2022 at 11:10PM

46
#265 - 한다윤 / @tuUnnB43XkoLZhl

03/31/2022 at 05:26AM

46
#266 - Brandon / @7hat_w4s_ep1c

04/15/2022 at 04:15AM

46
#267 - animal rescue / @kamelfanger83

06/10/2022 at 08:17PM

46
#268 - Atlas Goldn / @crypto_goldn

07/10/2022 at 02:20PM

47
#269 - Никита Семёнов / @NiKoS1707

04/13/2022 at 07:53PM

47
#270 - nyaa / @ClassOfProblem

05/17/2022 at 10:59PM