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

619 active golfers, 2663 entries

Leaderboard (lowest score wins):
31
#271 - Will Long / @WillLon30283972

06/17/2022 at 02:07PM

31
#272 - yann / @ylsarto

06/20/2022 at 06:18AM

31
#273 - Ariel Frischer / @ArielFrischer

06/26/2022 at 07:56PM

31
#274 - Joey E / @GigachadJoe

07/18/2022 at 11:55PM

31
#275 - Yannick / @Yannick88147038

07/19/2022 at 07:18PM

31
#276 - Omar Alawadhi / @OmarAla59544225

09/10/2022 at 10:18PM

31
#277 - Andrew Liu / @AndrewL45936893

09/19/2022 at 04:13AM

31
#278 - Nicholas Healy / @nickrhealy

12/18/2022 at 02:57PM

31
#279 - zoomhauer / @paulonhere

11/25/2023 at 09:55PM

31
#280 - Frédéric Heulin / @talineo

12/07/2023 at 11:16PM

31
#281 - ysw505 / @ysw505

01/14/2024 at 10:33AM

31
#282 - justgamer248 / @justgamer248

04/11/2024 at 10:47AM

31
#283 - amberg12 / @amberg12

08/02/2024 at 08:00PM

31
#284 - godjun123 / @godjun123

04/01/2025 at 03:14AM

31
#285 - woozhin / @woozhin

04/01/2025 at 10:43AM

31
#286 - lassion / @mutilator630

01/18/2026 at 12:15PM

32
#287 - 盧小小 / @VegetaLu

04/01/2022 at 03:35PM

32
#288 - Macunaíma / @Macunama11

05/06/2022 at 03:27PM

32
#289 - laityjet / @laityjet1

05/08/2022 at 02:45PM

32
#290 - Tim / @MarhjaKhazua

05/14/2022 at 09:35AM

32
#291 - K Br / @KBr20097882

09/05/2022 at 09:55PM

32
#292 - Connor / @ronnocthered

11/12/2022 at 03:25AM

32
#293 - ilyas / @Ahaaah2071

09/17/2023 at 05:47PM

32
#294 - Aaron Hunt / @ach5910

09/28/2023 at 03:35AM

32
#295 - rahatargz / @rahatargz

03/15/2024 at 09:00AM

32
#296 - 녹법칙 / @Rules_of_Green

04/08/2024 at 04:13PM

32
#297 - Namdrib / @Namdrib

07/21/2024 at 12:26PM

32
#298 - winter-loo / @winter-loo

07/08/2025 at 01:54AM

33
#299 - Graham Bates / @gigabates

04/12/2022 at 05:34PM

33
#300 - 이승찬 / @Tmc9kvp7woF9x0F

04/17/2022 at 01:47PM