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

603 active golfers, 2596 entries

Leaderboard (lowest score wins):
47
#481 - Weijian Duan / @GymRat102

08/23/2024 at 02:37PM

48
#482 - Michael Doron / @MichaelDoronII

03/19/2022 at 04:30AM

48
#483 - Stephen McCullough / @theonlyswmcc

03/26/2022 at 04:19AM

48
#484 - 지형 유 / @O_hr_good7

04/05/2022 at 07:34PM

48
#485 - Weipeng He / @he_weipeng

04/27/2022 at 08:54PM

48
#486 - yorkbai / @baiyqmzqbl

06/23/2022 at 07:38AM

48
#487 - Abdelrahman Madkour / @A3Madkour

08/19/2022 at 11:29PM

48
#488 - Godek Dominik / @dominik27182818

06/24/2023 at 11:36AM

48
#489 - Baptiste Mille-Mathias / @bmillemathias

12/23/2023 at 08:37AM

48
#490 - Joris / @CheeseAndChips

03/31/2024 at 08:32PM

49
#491 - caseyhadden / @caseyhadden

03/24/2022 at 08:46PM

49
#492 - josephtribulat / @josephtribulat

09/01/2024 at 01:03AM

49
#493 - seymour / @GaloisGroGauss

03/27/2025 at 02:58PM

50
#494 - Curtis Ault / @Curtis_Ault

04/01/2022 at 08:12PM

50
#495 - a(knzw) / @aknzw1

04/12/2022 at 08:20AM

50
#496 - El Achèche ANIS 🇹🇳 / @elacheche

04/25/2022 at 05:36AM

50
#497 - Jerry Liu / @JoelJoshanX

06/02/2022 at 01:55AM

50
#498 - Andy Tso / @AndyTso7

07/11/2022 at 12:06AM

50
#499 - Brandon Banks / @brandonmbanks

11/19/2022 at 03:08AM

50
#500 - Djairo / @djairoh

12/04/2023 at 06:38PM

51
#501 - Gunter Kluge / @KlugeGunter

04/05/2022 at 03:07PM

51
#502 - meleu.sh / @meleushell

05/06/2022 at 03:21PM

51
#503 - Eric Briand / @eric_briand

05/12/2022 at 07:16AM

51
#504 - dogmeat / @dogmeat11

05/24/2022 at 09:44AM

51
#505 - Sean Corr / @seanc01212

02/03/2024 at 10:07PM

51
#506 - Luca Carotenuto / @LucaCarote32207

03/06/2024 at 09:35PM

52
#507 - Sithe / @SitheTie

05/05/2022 at 10:09PM

52
#508 - sjosbbfkd / @sjosbbfkd

05/15/2022 at 06:09AM

52
#509 - Denis / @swmmci

06/28/2022 at 11:00PM

52
#510 - Joe Bushi / @joebushi

12/01/2022 at 12:32AM