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

472 active golfers, 1968 entries

Leaderboard (lowest score wins):
42
#331 - Eric Guo / @Euclideant

06/19/2022 at 11:42AM

42
#332 - Nathan Iszlaub / @NIszlaub

10/21/2022 at 05:51PM

42
#333 - ⚫ hgtp://Shifor 🛠️ / @shifor_gnome

02/27/2023 at 03:29PM

42
#334 - Nikolay Miroshnychenko / @Nick_Mirosh

07/19/2023 at 07:37AM

42
#335 - raverbash / @raverbash

08/09/2023 at 11:18PM

42
#336 - dailybeef / @dailybeef

11/07/2023 at 03:29PM

43
#337 - onkeL / @onkeL_cs

03/19/2022 at 11:03PM

43
#338 - Michael Mior / @michaelmior

04/06/2022 at 07:51PM

43
#339 - 余超 / @SpicyChicken_yc

05/24/2022 at 03:11AM

43
#340 - averagebit / @averagebyte

10/03/2022 at 11:03AM

43
#341 - Michael Pallazola / @pallazola

12/18/2022 at 07:56AM

43
#342 - Duy nguyễn / @Duycld03

07/27/2023 at 06:13PM

44
#343 - James Duffy / @jduffy3

04/08/2022 at 02:19AM

44
#344 - Enrique Santana / @esantanaya

04/24/2022 at 02:36AM

44
#345 - Carlos / @Karu75414928

06/04/2022 at 10:37AM

44
#346 - mika / @mika31120321

07/29/2022 at 06:27PM

44
#347 - Samantha / @Samantha_fga

10/13/2022 at 07:48AM

44
#348 - jimmarq / @jimmarq

10/27/2022 at 05:25PM

44
#349 - 成 / @Quanuanc

12/04/2022 at 01:09PM

44
#350 - Ibby / @sleepy_swords

06/18/2023 at 02:29PM

44
#351 - Maurice Schmicking / @m_schmicking

11/23/2023 at 12:52PM

45
#352 - Jovi  / @jovinh0_

05/08/2022 at 09:03AM

45
#353 - x03n046 / @x03n046

05/10/2022 at 02:39AM

45
#354 - Ammar Qaffaf / @AmmarQaffaf

05/19/2022 at 08:35PM

45
#355 - Hidde Eertman / @hidde_eertman

12/12/2022 at 02:43PM

45
#356 - Jan Lukány / @Lukanyj

01/02/2023 at 05:34PM

45
#357 - Alex Pepper / @pepper18608

09/15/2023 at 05:43PM

46
#358 - Julio CPP / @jcaesarpp

03/18/2022 at 11:10PM

46
#359 - 한다윤 / @tuUnnB43XkoLZhl

03/31/2022 at 05:26AM

46
#360 - Brandon / @7hat_w4s_ep1c

04/15/2022 at 04:15AM