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):
34
#181 - Александр Черенков / @AleksandrCeren3

08/04/2022 at 03:15PM

34
#182 - Akshay Barpute / @akshaybarpute

09/26/2022 at 01:40AM

35
#183 - Mark Blakeney / @bulletmark

03/18/2022 at 01:35AM

35
#184 - Alan. / @yisusalan

03/21/2022 at 04:41AM

35
#185 - pusha t daily / @rudellius

04/08/2022 at 09:02PM

35
#186 - Muziek voor Meloenen / @VoorMeloenen

04/13/2022 at 02:51PM

35
#187 - 할핳 / @vimgolfYOUNG

04/16/2022 at 05:08AM

35
#188 - Ragtime / @TheRagtimeBlues

05/05/2022 at 06:33PM

35
#189 - compter651 / @compter651

06/04/2022 at 10:11AM

35
#190 - Benjamin Verjus / @Tart0f

07/03/2022 at 11:55PM

35
#191 - Guilherme Lima / @guilima10

08/09/2022 at 06:05PM

35
#192 - Léo / @Leo58369183

08/22/2022 at 10:40AM

35
#193 - Ratkovszki István / @RatkovszkiIstvn

09/05/2022 at 01:19PM

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

09/13/2022 at 05:26AM

35
#195 - Oleg Olesinski / @hex0n1

09/18/2022 at 09:53PM

35
#196 - LordPax / @LordPompax

10/04/2022 at 05:37PM

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

10/27/2022 at 04:41PM

35
#198 - Lars Winderling / @kaHaleMaKai

11/28/2022 at 08:23PM

35
#199 - Ryuichiroh Ikeuchi / @ryuichiroh_ike

11/30/2022 at 03:27PM

35
#200 - AIUEHARA / @AIUEHARA15

12/04/2022 at 02:07PM

36
#201 - Andrew Savino / @AndrewSavino5

03/24/2022 at 08:56PM

36
#202 - rr / @rodgeur31

03/28/2022 at 10:13PM

36
#203 - anonymouse / @anonymo65837183

04/03/2022 at 04:30PM

36
#204 - aravindthangavel / @aravindpt

04/20/2022 at 12:47AM

36
#205 - Systemfehler / @Systemerror7A69

05/12/2022 at 05:04PM

36
#206 - vanniuner / @vanniuner

05/18/2022 at 12:59AM

36
#207 - Robberechts Arne / @ArneRobberechts

05/22/2022 at 11:17AM

36
#208 - samsepiol / @samsepi81094451

07/08/2022 at 12:57PM

36
#209 - Van / @dangtrivan15

09/11/2022 at 10:13AM

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

09/21/2022 at 03:26AM