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 202 remaining solutions by signing in and submitting your own entry
#203 徐坤 蔡 / @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

203 active golfers, 793 entries

Leaderboard (lowest score wins):
26
#1 - Jean George / @JeanGeo20504212

03/18/2022 at 12:35PM

26
#2 - John Braxler / @braxler

03/18/2022 at 02:33PM

26
#3 - Smylers / @Smylers2

03/18/2022 at 07:38PM

26
#4 - Jon Krause / @jkrause314

03/19/2022 at 03:33AM

26
#5 - Brett Bender / @brttbndr

03/20/2022 at 04:08PM

26
#6 - sarah.getter / @sarahgetter82

03/21/2022 at 05:11AM

26
#7 - Sando Itchi / @sando_itchi

03/23/2022 at 02:33AM

26
#8 - Ramtin Martin / @martin_ramtin

03/25/2022 at 12:00AM

26
#9 - hamb / @hamb88140219

03/25/2022 at 12:04AM

26
#10 - Pedro Minicz / @pedrominicz

03/26/2022 at 08:41PM

26
#11 - mold mild / @mild_mold

04/02/2022 at 02:49PM

26
#12 - Choi Eun Chang / @fateflyec

04/05/2022 at 03:19AM

26
#13 - NippyPtarmigan 💙 / @NippyPtarmigan

04/05/2022 at 10:24AM

26
#14 - 심우현 / @tmvlem5671

04/05/2022 at 12:12PM

26
#15 - John Xu / @xzzhiao

04/06/2022 at 01:22AM

26
#16 - w1ck3r / @w1ck3r_dr0p

04/08/2022 at 05:09PM

26
#17 - Jeff Davis / @MrJefedavis

04/12/2022 at 07:14PM

26
#18 - 아스 / @dfakjepv3lq

04/17/2022 at 12:01PM

26
#19 - yeom / @yeomhuigeon

04/18/2022 at 08:39AM

26
#20 - Eviber / @youvaaaaa

04/30/2022 at 07:09PM

26
#21 - quemeraisc / @quemeraisc

05/02/2022 at 03:04PM

26
#22 - Marc Jethro Avila / @maje_avila

05/07/2022 at 12:16PM

26
#23 - russellzhaomao / @russellzhaomao

05/18/2022 at 07:48AM

26
#24 - Pablo Cárdenas / @pablo_cardenasb

05/19/2022 at 02:25AM

26
#25 - Levi Wheeler / @LeviWhe68726437

05/19/2022 at 11:08PM

26
#26 - Ron / @ronnie9ball

05/20/2022 at 03:12AM

26
#27 - jcbglbmn / @JacobGelbman

05/20/2022 at 08:25PM

27
#28 - Saki Gw / @Sakigw

03/18/2022 at 06:45AM

27
#29 - Brian Leung / @brian_leung

03/26/2022 at 04:02AM

27
#30 - 준현 / @xpexpe2

04/01/2022 at 11:24AM