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 308 remaining solutions by signing in and submitting your own entry
#309 徐坤 蔡 / @xukunca10413866 - Score: 214 - 05/21/22 @ 03:54
/<BS>:%a<BS>s/ = /=/9<CR><Up>ijj<BS><BS><Esc>jjjjjjjjjjjjjjjkkkkkkkkkkkkkjjjjjjjjjjjjjkkkkkkkkkkkjjjjjjj/= <BS><BS> = <CR>caw=<Esc>lxj..uuhjjjkkknNcaw<Del>=<Esc>n.n.i<Esc>puggdGi<50-53>#!/bin/bash<CR>a=5<CR>b=10<CR>sum=$((a + b))<CR>echo $sum<CR><CR>mul=$((a * b))<CR>echo $mul<Esc>[201~<Esc>:wq<CR>

0 comments


Created by: @u_hossein

309 active golfers, 1238 entries

Leaderboard (lowest score wins):
121
#301 - Jiri Coviet / @JCoviet

04/07/2022 at 03:18PM

127
#302 - Jez dufourq / @Jezdufourq

06/19/2022 at 11:24AM

130
#303 - 전정민 / @ppuep2

03/18/2022 at 12:29PM

136
#304 - Mat / @mateuscolvr

04/03/2022 at 05:04AM

151
#305 - Briel Santana / @briel_santana

06/02/2022 at 11:53AM

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

09/08/2022 at 07:39AM

175
#307 - unchi / @unchi10723002

05/06/2022 at 12:08PM

187
#308 - Plamen Andreev / @plam4u

03/20/2022 at 11:28AM

214
#309 - 徐坤 蔡 / @xukunca10413866

05/21/2022 at 03:54AM