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):
79
#571 - 高卫东 / @Crazy_________K

09/30/2022 at 06:37AM

83
#572 - asayake / @995himada

04/09/2022 at 01:27PM

84
#573 - Daniel Mota / @danielmotaa11

06/01/2022 at 04:21AM

84
#574 - euuun0 / @euuun0

04/13/2024 at 05:31PM

87
#575 - Michael Carolin / @mpcarolin

05/07/2022 at 03:01PM

89
#576 - Ryan Murphy / @RyanMur03026891

04/26/2022 at 12:43PM

89
#577 - Benjamin / @benjamin_le_

05/19/2022 at 04:01AM

89
#578 - 김태완 / @kr_srpn

01/17/2023 at 04:23AM

90
#579 - Jerred Shepherd / @ShepherdJerred

05/04/2022 at 10:19PM

90
#580 - dan-bernstein / @dan-bernstein

07/25/2024 at 02:39AM

91
#581 - asdf / @asdf75821425

05/21/2022 at 04:37PM

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

04/06/2022 at 05:13PM

94
#583 - Hart Traveller / @HartTraveller

05/11/2022 at 07:30AM

96
#584 - yurei / @yurei38667012

12/16/2022 at 07:44AM

97
#585 - TOM / @TOM19348482

05/22/2022 at 09:32AM

99
#586 - Mikołaj / @miko_aj4846

09/03/2023 at 03:14PM

99
#587 - abc def / @abcdef1793870

10/29/2023 at 02:59AM

100
#588 - jack2023xxx / @jack2023xxx

08/28/2023 at 03:15PM

110
#589 - Sean Rice / @SeanRice97

10/09/2023 at 02:12AM

121
#590 - Jiri Coviet / @JCoviet

04/07/2022 at 03:18PM

127
#591 - Jez dufourq / @Jezdufourq

06/19/2022 at 11:24AM

128
#592 - Shunlei Zhang / @slzhang13

05/03/2024 at 03:02PM

130
#593 - 전정민 / @ppuep2

03/18/2022 at 12:29PM

133
#594 - 苏庆祝 / @sqngzh21

01/17/2023 at 12:53AM

136
#595 - Mat / @mateuscolvr

04/03/2022 at 05:04AM

139
#596 - Edward Chen / @chen_eddi

06/08/2023 at 02:50PM

151
#597 - Briel Santana / @briel_santana

06/02/2022 at 11:53AM

153
#598 - 💻:~/Karl_Webster / @KTW727

09/08/2022 at 07:39AM

175
#599 - unchi / @unchi10723002

05/06/2022 at 12:08PM

187
#600 - Plamen Andreev / @plam4u

03/20/2022 at 11:28AM