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

490 active golfers, 2047 entries

Leaderboard (lowest score wins):
44
#361 - Samantha / @Samantha_fga

10/13/2022 at 07:48AM

44
#362 - jimmarq / @jimmarq

10/27/2022 at 05:25PM

44
#363 - 成 / @Quanuanc

12/04/2022 at 01:09PM

44
#364 - Ibby / @sleepy_swords

06/18/2023 at 02:29PM

44
#365 - Maurice Schmicking / @m_schmicking

11/23/2023 at 12:52PM

45
#366 - Jovi  / @jovinh0_

05/08/2022 at 09:03AM

45
#367 - x03n046 / @x03n046

05/10/2022 at 02:39AM

45
#368 - Ammar Qaffaf / @AmmarQaffaf

05/19/2022 at 08:35PM

45
#369 - Hidde Eertman / @hidde_eertman

12/12/2022 at 02:43PM

45
#370 - Jan Lukány / @Lukanyj

01/02/2023 at 05:34PM

45
#371 - Alex Pepper / @pepper18608

09/15/2023 at 05:43PM

45
#372 - satake0916 / @satake0916

12/21/2023 at 01:11AM

46
#373 - Julio CPP / @jcaesarpp

03/18/2022 at 11:10PM

46
#374 - 한다윤 / @tuUnnB43XkoLZhl

03/31/2022 at 05:26AM

46
#375 - Brandon / @7hat_w4s_ep1c

04/15/2022 at 04:15AM

46
#376 - animal rescue / @kamelfanger83

06/10/2022 at 08:17PM

46
#377 - Atlas Goldn / @crypto_goldn

07/10/2022 at 02:20PM

46
#378 - RaBot / @realRaBot

04/04/2023 at 10:29PM

46
#379 - aspiring robber baron / @0xApophenia

05/22/2023 at 04:47AM

46
#380 - funorange / @FunOrange42

06/17/2023 at 06:51PM

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

04/13/2022 at 07:53PM

47
#382 - nyaa / @ClassOfProblem

05/17/2022 at 10:59PM

47
#383 - Andrii Kapinos / @AndriiKapinos

05/23/2022 at 09:11AM

47
#384 - noseskdjs / @nosekxkfkd

06/24/2022 at 06:29PM

47
#385 - Alexandre Daoud / @AlexandreDaoud

06/10/2023 at 05:48AM

48
#386 - Michael Doron / @MichaelDoronII

03/19/2022 at 04:30AM

48
#387 - Stephen McCullough / @theonlyswmcc

03/26/2022 at 04:19AM

48
#388 - 지형 유 / @O_hr_good7

04/05/2022 at 07:34PM

48
#389 - Weipeng He / @he_weipeng

04/27/2022 at 08:54PM

48
#390 - yorkbai / @baiyqmzqbl

06/23/2022 at 07:38AM