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):
97
#601 - TOM / @TOM19348482

05/22/2022 at 09:32AM

99
#602 - Mikołaj / @miko_aj4846

09/03/2023 at 03:14PM

99
#603 - abc def / @abcdef1793870

10/29/2023 at 02:59AM

100
#604 - jack2023xxx / @jack2023xxx

08/28/2023 at 03:15PM

110
#605 - Sean Rice / @SeanRice97

10/09/2023 at 02:12AM

121
#606 - Jiri Coviet / @JCoviet

04/07/2022 at 03:18PM

127
#607 - Jez dufourq / @Jezdufourq

06/19/2022 at 11:24AM

128
#608 - Shunlei Zhang / @slzhang13

05/03/2024 at 03:02PM

130
#609 - 전정민 / @ppuep2

03/18/2022 at 12:29PM

133
#610 - 苏庆祝 / @sqngzh21

01/17/2023 at 12:53AM

136
#611 - Mat / @mateuscolvr

04/03/2022 at 05:04AM

139
#612 - Edward Chen / @chen_eddi

06/08/2023 at 02:50PM

151
#613 - Briel Santana / @briel_santana

06/02/2022 at 11:53AM

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

09/08/2022 at 07:39AM

175
#615 - unchi / @unchi10723002

05/06/2022 at 12:08PM

187
#616 - Plamen Andreev / @plam4u

03/20/2022 at 11:28AM

200
#617 - Miguel Alcaraz / @dr_miguelar

01/23/2023 at 10:11PM

214
#618 - 徐坤 蔡 / @xukunca10413866

05/21/2022 at 03:54AM

246
#619 - 陈石峰 / @lazycode1226

10/10/2022 at 06:45AM