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

541 active golfers, 2339 entries

Leaderboard (lowest score wins):
61
#481 - ylv / @ylv_io

04/01/2022 at 09:54PM

61
#482 - Pham Tuan Anh / @anhpt379

07/10/2022 at 10:52AM

61
#483 - hyunw0n / @hyunw0n

04/13/2024 at 07:15AM

62
#484 - Alan Rezende 🔥 Full Stack Developer / @alanrezende

04/30/2022 at 08:02PM

62
#485 - Alex Liu / @liualexliualex

05/21/2022 at 07:09AM

62
#486 - djheidihoe / @djheidihoe1

07/18/2022 at 10:01PM

63
#487 - gohuorse / @go_hourse

05/21/2022 at 02:32PM

63
#488 - Thomas Hiron / @thomashiron

02/20/2023 at 10:45AM

64
#489 - Alexander Ruiztagle / @aruiz_tagle

11/24/2022 at 10:48AM

65
#490 - Raimondas Kazlauskas / @RhymondK

03/28/2022 at 02:17PM

65
#491 - Cyrus Kirk / @cyrusjkirk

02/02/2023 at 03:17PM

65
#492 - Leander / @LiLangning

04/06/2024 at 02:30PM

66
#493 - Gregory Bleiker / @gregory_bleiker

03/23/2022 at 01:52PM

66
#494 - Milan Gunasekera / @GunasekeraMilan

03/30/2022 at 08:41AM

66
#495 - Ty Harlacker / @tizzleh

10/22/2022 at 12:35AM

67
#496 - Abhijeet Bodas / @apbodas

10/30/2022 at 04:58PM

67
#497 - marco3islas / @marco3islas

05/15/2023 at 10:42AM

67
#498 - Aayush Dutt / @AayushDutt

07/10/2023 at 12:14PM

68
#499 - D G G / @DGJourneyman

02/20/2023 at 11:12AM

70
#500 - Eric Wennerberg / @ericwenn

03/20/2022 at 03:50PM

70
#501 - Max Maier / @Max_Maier_VIE

12/20/2022 at 01:25PM

71
#502 - David Tchanturia / @daviti85142401

05/14/2022 at 03:50PM

71
#503 - David / @garsjaune

01/05/2023 at 03:14PM

72
#504 - Brian Tracey / @btrachey

06/06/2022 at 03:35AM

72
#505 - A B / @darrinbliler

11/10/2023 at 04:43PM

73
#506 - Fedleder / @fedleder

03/18/2022 at 09:17PM

73
#507 - Orsós Ádám / @adamspindle

06/16/2022 at 11:41AM

74
#508 - Andrew / @andrewperkins

04/09/2024 at 01:44AM

75
#509 - Zhou Jiazheng / @ZhouJiazheng0

02/09/2023 at 08:14AM

78
#510 - Daneil yan / @ex4722

03/30/2022 at 09:59PM