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):
62
#541 - djheidihoe / @djheidihoe1

07/18/2022 at 10:01PM

62
#542 - e.cousinet / @ecousinet

07/16/2024 at 07:20PM

63
#543 - gohuorse / @go_hourse

05/21/2022 at 02:32PM

63
#544 - Thomas Hiron / @thomashiron

02/20/2023 at 10:45AM

64
#545 - Alexander Ruiztagle / @aruiz_tagle

11/24/2022 at 10:48AM

64
#546 - Willy / @Willy6932612311

08/30/2024 at 06:56AM

65
#547 - Raimondas Kazlauskas / @RhymondK

03/28/2022 at 02:17PM

65
#548 - Cyrus Kirk / @cyrusjkirk

02/02/2023 at 03:17PM

65
#549 - Leander / @LiLangning

04/06/2024 at 02:30PM

65
#550 - Bùi Lê Huỳnh / @wyattbui

06/07/2024 at 05:03PM

66
#551 - Gregory Bleiker / @gregory_bleiker

03/23/2022 at 01:52PM

66
#552 - Milan Gunasekera / @GunasekeraMilan

03/30/2022 at 08:41AM

66
#553 - Ty Harlacker / @tizzleh

10/22/2022 at 12:35AM

67
#554 - Abhijeet Bodas / @apbodas

10/30/2022 at 04:58PM

67
#555 - marco3islas / @marco3islas

05/15/2023 at 10:42AM

67
#556 - Aayush Dutt / @AayushDutt

07/10/2023 at 12:14PM

68
#557 - D G G / @DGJourneyman

02/20/2023 at 11:12AM

70
#558 - Eric Wennerberg / @ericwenn

03/20/2022 at 03:50PM

70
#559 - Max Maier / @Max_Maier_VIE

12/20/2022 at 01:25PM

71
#560 - David Tchanturia / @daviti85142401

05/14/2022 at 03:50PM

71
#561 - David / @garsjaune

01/05/2023 at 03:14PM

71
#562 - LongLiveMyLove / @LongLiveMyLove

07/19/2024 at 07:53AM

72
#563 - Brian Tracey / @btrachey

06/06/2022 at 03:35AM

72
#564 - A B / @darrinbliler

11/10/2023 at 04:43PM

73
#565 - Fedleder / @fedleder

03/18/2022 at 09:17PM

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

06/16/2022 at 11:41AM

74
#567 - Andrew / @andrewperkins

04/09/2024 at 01:44AM

75
#568 - Zhou Jiazheng / @ZhouJiazheng0

02/09/2023 at 08:14AM

75
#569 - HashData / @HashData

05/13/2024 at 05:19PM

78
#570 - Daneil yan / @ex4722

03/30/2022 at 09:59PM