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):
41
#421 - Toni Sedlmeier / @SedlmeierToni

01/10/2023 at 12:37PM

41
#422 - nerfed / @nerfed

06/03/2024 at 11:08PM

41
#423 - Aryan Kadole / @ak1932

08/17/2024 at 07:28PM

42
#424 - Richy Strnad / @RichardStrnad

03/19/2022 at 08:09PM

42
#425 - Quatrix / @Quatrix

04/08/2022 at 10:29PM

42
#426 - 梅 / @umetosawara

04/09/2022 at 08:04AM

42
#427 - タケ / @Take3832

04/17/2022 at 01:18PM

42
#428 - Eric Guo / @Euclideant

06/19/2022 at 11:42AM

42
#429 - Nathan Iszlaub / @NIszlaub

10/21/2022 at 05:51PM

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

02/27/2023 at 03:29PM

42
#431 - Nikolay Miroshnychenko / @Nick_Mirosh

07/19/2023 at 07:37AM

42
#432 - raverbash / @raverbash

08/09/2023 at 11:18PM

42
#433 - dailybeef / @dailybeef

11/07/2023 at 03:29PM

42
#434 - potatol33t / @potatol33t

03/13/2024 at 02:41PM

42
#435 - John Kershaw / @johnkershaw

04/21/2024 at 05:43PM

42
#436 - Alastair Macfarlane / @macfarlane-dev

05/12/2024 at 12:56PM

42
#437 - Pablo Acuna / @pacuna

08/30/2024 at 12:51AM

42
#438 - Grégoire Cutzach / @hexaltation

09/19/2024 at 09:42AM

43
#439 - onkeL / @onkeL_cs

03/19/2022 at 11:03PM

43
#440 - Michael Mior / @michaelmior

04/06/2022 at 07:51PM

43
#441 - 余超 / @SpicyChicken_yc

05/24/2022 at 03:11AM

43
#442 - averagebit / @averagebyte

10/03/2022 at 11:03AM

43
#443 - Michael Pallazola / @pallazola

12/18/2022 at 07:56AM

43
#444 - Duy nguyễn / @Duycld03

07/27/2023 at 06:13PM

43
#445 - Adrián Fidalgo-Díaz / @adrianFD22

12/13/2023 at 09:52PM

43
#446 - shahanavaz m / @shahanavazm

03/29/2024 at 01:22AM

44
#447 - James Duffy / @jduffy3

04/08/2022 at 02:19AM

44
#448 - Enrique Santana / @esantanaya

04/24/2022 at 02:36AM

44
#449 - Carlos / @Karu75414928

06/04/2022 at 10:37AM

44
#450 - mika / @mika31120321

07/29/2022 at 06:27PM