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

589 active golfers, 2544 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 / @_JefeDavis_

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

26
#28 - サイシ / @tairar_314

06/03/2022 at 06:39AM

26
#29 - Honza Uhlík / @JanUhlik

06/11/2022 at 07:31AM

26
#30 - Ekalos / @_Ekalos

06/12/2022 at 07:12AM