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

607 active golfers, 2606 entries

Leaderboard (lowest score wins):
74
#571 - Andrew / @andrewperkins

04/09/2024 at 01:44AM

75
#572 - Zhou Jiazheng / @ZhouJiazheng0

02/09/2023 at 08:14AM

75
#573 - HashData / @HashData

05/13/2024 at 05:19PM

78
#574 - Daneil yan / @ex4722

03/30/2022 at 09:59PM

79
#575 - 高卫东 / @Crazy_________K

09/30/2022 at 06:37AM

83
#576 - asayake / @995himada

04/09/2022 at 01:27PM

84
#577 - Daniel Mota / @danielmotaa11

06/01/2022 at 04:21AM

84
#578 - euuun0 / @euuun0

04/13/2024 at 05:31PM

87
#579 - Michael Carolin / @mpcarolin

05/07/2022 at 03:01PM

89
#580 - Ryan Murphy / @RyanMur03026891

04/26/2022 at 12:43PM

89
#581 - Benjamin / @benjamin_le_

05/19/2022 at 04:01AM

89
#582 - 김태완 / @kr_srpn

01/17/2023 at 04:23AM

90
#583 - Jerred Shepherd / @ShepherdJerred

05/04/2022 at 10:19PM

90
#584 - dan-bernstein / @dan-bernstein

07/25/2024 at 02:39AM

91
#585 - asdf / @asdf75821425

05/21/2022 at 04:37PM

94
#586 - Dončić Stan / @blackmesssi

04/06/2022 at 05:13PM

94
#587 - Hart Traveller / @HartTraveller

05/11/2022 at 07:30AM

96
#588 - yurei / @yurei38667012

12/16/2022 at 07:44AM

97
#589 - TOM / @TOM19348482

05/22/2022 at 09:32AM

99
#590 - Mikołaj / @miko_aj4846

09/03/2023 at 03:14PM

99
#591 - abc def / @abcdef1793870

10/29/2023 at 02:59AM

100
#592 - jack2023xxx / @jack2023xxx

08/28/2023 at 03:15PM

110
#593 - Sean Rice / @SeanRice97

10/09/2023 at 02:12AM

121
#594 - Jiri Coviet / @JCoviet

04/07/2022 at 03:18PM

127
#595 - Jez dufourq / @Jezdufourq

06/19/2022 at 11:24AM

128
#596 - Shunlei Zhang / @slzhang13

05/03/2024 at 03:02PM

130
#597 - 전정민 / @ppuep2

03/18/2022 at 12:29PM

133
#598 - 苏庆祝 / @sqngzh21

01/17/2023 at 12:53AM

136
#599 - Mat / @mateuscolvr

04/03/2022 at 05:04AM

139
#600 - Edward Chen / @chen_eddi

06/08/2023 at 02:50PM