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):
29
#211 - sjdfd / @sjdfd190584

04/14/2023 at 07:07AM

29
#212 - Иван / @wansmer

04/23/2023 at 01:54PM

29
#213 - Geoff Liu / @geoff_liu

09/23/2023 at 10:27PM

29
#214 - Dal_Peng / @dalpang81

04/10/2024 at 02:28AM

29
#215 - im sung / @imsung751775

04/10/2024 at 07:25AM

29
#216 - xxlsheep / @xxlsheep

04/11/2024 at 12:42PM

29
#217 - westray420 / @westray420

04/12/2024 at 12:02PM

29
#218 - KTH-1 / @KTH-1

04/13/2024 at 01:26PM

29
#219 - pp0ng / @pp0ng

04/14/2024 at 08:42AM

30
#220 - Daniel Harding / @living_180

04/14/2022 at 11:41AM

30
#221 - delnoch / @delnoch1

04/16/2022 at 07:45AM

30
#222 - ff df / @ffdf93207177

04/18/2022 at 05:44AM

30
#223 - Gen / @gen_f_74

05/18/2022 at 12:01AM

30
#224 - Kwizer / @kwizer

05/29/2022 at 09:20AM

30
#225 - Driver / @zhouyijiaren

06/11/2022 at 10:43AM

30
#226 - Mario / @MarioWolfe

06/16/2022 at 05:07AM

30
#227 - electronjunkie / @electronjunkie

07/12/2022 at 01:58PM

30
#228 - 王扎尔 / @wngzhr2

09/08/2022 at 06:47AM

30
#229 - vuems / @vuems2win

11/10/2022 at 06:07PM

30
#230 - Geek Boy / @Geek79

11/11/2022 at 12:34AM

30
#231 - Funky McBeef / @FunkyMcBeef

11/16/2022 at 02:39PM

30
#232 - mindgitrwx / @mindgitrwx

11/28/2022 at 02:39AM

30
#233 - Eric Johansson / @ericwjohansson

04/24/2023 at 06:49PM

30
#234 - Daniel Simionato / @weseven

06/23/2023 at 12:27PM

30
#235 - くりち / 栗原佑弥 / @kurichi97

07/08/2023 at 08:43AM

30
#236 - Sahil Gill / @taarkik_

10/15/2023 at 07:50AM

30
#237 - Leon Katsnelson / @leonkatsnelson

12/15/2023 at 08:20PM

30
#238 - diwa / @LuoDi-Nate

02/02/2024 at 09:22AM

30
#239 - Penbu / @penbuvt

02/16/2024 at 03:07AM

30
#240 - bonettimrc / @bonettimrc

04/24/2024 at 06:17PM