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

347 active golfers, 1402 entries

Leaderboard (lowest score wins):
89
#331 - Ryan Murphy / @RyanMur03026891

04/26/2022 at 12:43PM

89
#332 - Benjamin / @benjamin_le_

05/19/2022 at 04:01AM

90
#333 - Jerred Shepherd / @ShepherdJerred

05/04/2022 at 10:19PM

91
#334 - asdf / @asdf75821425

05/21/2022 at 04:37PM

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

04/06/2022 at 05:13PM

94
#336 - Hart Traveller / @HartTraveller

05/11/2022 at 07:30AM

97
#337 - TOM / @TOM19348482

05/22/2022 at 09:32AM

121
#338 - Jiri Coviet / @JCoviet

04/07/2022 at 03:18PM

127
#339 - Jez dufourq / @Jezdufourq

06/19/2022 at 11:24AM

130
#340 - 전정민 / @ppuep2

03/18/2022 at 12:29PM

136
#341 - Mat / @mateuscolvr

04/03/2022 at 05:04AM

151
#342 - Briel Santana / @briel_santana

06/02/2022 at 11:53AM

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

09/08/2022 at 07:39AM

175
#344 - unchi / @unchi10723002

05/06/2022 at 12:08PM

187
#345 - Plamen Andreev / @plam4u

03/20/2022 at 11:28AM

214
#346 - 徐坤 蔡 / @xukunca10413866

05/21/2022 at 03:54AM

246
#347 - 陈石峰 / @lazycode1226

10/10/2022 at 06:45AM