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

450 active golfers, 1852 entries

Leaderboard (lowest score wins):
35
#241 - Muziek voor Meloenen / @VoorMeloenen

04/13/2022 at 02:51PM

35
#242 - 할핳 / @vimgolfYOUNG

04/16/2022 at 05:08AM

35
#243 - Ragtime / @TheRagtimeBlues

05/05/2022 at 06:33PM

35
#244 - compter651 / @compter651

06/04/2022 at 10:11AM

35
#245 - Benjamin Verjus / @Tart0f

07/03/2022 at 11:55PM

35
#246 - Guilherme Lima / @guilima10

08/09/2022 at 06:05PM

35
#247 - Léo / @Leo58369183

08/22/2022 at 10:40AM

35
#248 - Ratkovszki István / @RatkovszkiIstvn

09/05/2022 at 01:19PM

35
#249 - Dr. Peťko / @PetkoDr

09/13/2022 at 05:26AM

35
#250 - Oleg Olesinski / @hex0n1

09/18/2022 at 09:53PM

35
#251 - LordPax / @LordPompax

10/04/2022 at 05:37PM

35
#252 - #шлюхаиспания #majoriesMàgiques / @Mo66452567

10/27/2022 at 04:41PM

35
#253 - Lars Winderling / @kaHaleMaKai

11/28/2022 at 08:23PM

35
#254 - Ryuichiroh Ikeuchi / @ryuichiroh_ike

11/30/2022 at 03:27PM

35
#255 - AIUEHARA / @AIUEHARA15

12/04/2022 at 02:07PM

35
#256 - Ringel Natter / @SenorTenor

02/10/2023 at 11:15PM

35
#257 - RosaTryp / @RosaTryp

03/10/2023 at 03:19PM

35
#258 - 💗 / @Vfhwk847bd

04/14/2023 at 06:21AM

35
#259 - YaaO - you are an original / @RolfNyffenegger

08/11/2023 at 06:36PM

36
#260 - Andrew Savino / @AndrewSavino5

03/24/2022 at 08:56PM

36
#261 - rr / @rodgeur31

03/28/2022 at 10:13PM

36
#262 - anonymouse / @anonymo65837183

04/03/2022 at 04:30PM

36
#263 - aravindthangavel / @aravindpt

04/20/2022 at 12:47AM

36
#264 - Systemfehler / @Systemerror7A69

05/12/2022 at 05:04PM

36
#265 - vanniuner / @vanniuner

05/18/2022 at 12:59AM

36
#266 - Robberechts Arne / @ArneRobberechts

05/22/2022 at 11:17AM

36
#267 - samsepiol / @samsepi81094451

07/08/2022 at 12:57PM

36
#268 - Van / @dangtrivan15

09/11/2022 at 10:13AM

36
#269 - キムラ・OPEL・ユウジ / @kimurayuuji79

09/21/2022 at 03:26AM

36
#270 - vimgolfaccfekxh / @vimgolfaccfekxh

09/28/2022 at 07:58PM