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

351 active golfers, 1432 entries

Leaderboard (lowest score wins):
29
#121 - Arthur DELORT / @artDelort

06/15/2022 at 03:10PM

29
#122 - Siddharth Murali / @SidTweetsALess

06/24/2022 at 10:08AM

29
#123 - 小山内まい / @osanamity

07/13/2022 at 08:55AM

29
#124 - nauj / @nauj_w

07/29/2022 at 05:49AM

29
#125 - bastien batardier / @supercamarche

10/07/2022 at 05:40PM

29
#126 - Dank City / @ddankcity

12/04/2022 at 10:52PM

30
#127 - Daniel Harding / @living_180

04/14/2022 at 11:41AM

30
#128 - delnoch / @delnoch1

04/16/2022 at 07:45AM

30
#129 - ff df / @ffdf93207177

04/18/2022 at 05:44AM

30
#130 - Gen / @gen_f_74

05/18/2022 at 12:01AM

30
#131 - Kwizer / @kwizer

05/29/2022 at 09:20AM

30
#132 - Driver / @zhouyijiaren

06/11/2022 at 10:43AM

30
#133 - Mario / @MarioWolfe

06/16/2022 at 05:07AM

30
#134 - electronjunkie / @electronjunkie

07/12/2022 at 01:58PM

30
#135 - 王扎尔 / @wngzhr2

09/08/2022 at 06:47AM

30
#136 - vuems / @vuems2win

11/10/2022 at 06:07PM

30
#137 - Geek Boy / @Geek79

11/11/2022 at 12:34AM

30
#138 - Funky McBeef / @FunkyMcBeef

11/16/2022 at 02:39PM

30
#139 - mindgitrwx / @mindgitrwx

11/28/2022 at 02:39AM

31
#140 - sean.yang / @seanyangc

03/18/2022 at 03:08AM

31
#141 - h / @tgen22334

03/18/2022 at 08:55AM

31
#142 - Richard Smith / @appsmithuk

03/19/2022 at 01:50AM

31
#143 - Andreas Aumann / @andreasaumann

03/20/2022 at 04:16PM

31
#144 - Pawel Wenda / @pwlwnd

03/27/2022 at 08:09PM

31
#145 - dorianm / @dorianm

03/28/2022 at 03:51AM

31
#146 - rnakai / @rnakai_42

03/30/2022 at 08:17AM

31
#147 - Chun Chanjun / @CChanjun

03/30/2022 at 10:14AM

31
#148 - Ansuman Bardalai / @abardalai

04/11/2022 at 06:49AM

31
#149 - Johnnie Walker / @Johnnie11414500

04/11/2022 at 02:00PM

31
#150 - 그안합 / @asm6788_kor

04/15/2022 at 02:17PM