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

476 active golfers, 1974 entries

Leaderboard (lowest score wins):
27
#61 - Ji_Hyeong / @PlzstopIT7

04/12/2022 at 04:44PM

27
#62 - div_sum / @divsum1

04/14/2022 at 04:27PM

27
#63 - CONNOR / @CONNOR32315543

04/15/2022 at 12:44AM

27
#64 - Jim Nanney / @jnanney

04/15/2022 at 02:56AM

27
#65 - Chris Bash / @Bash_Chris1

04/15/2022 at 01:44PM

27
#66 - lll / @skdjd01719

04/15/2022 at 05:28PM

27
#67 - nihilistkitten / @nihilistkitten1

04/15/2022 at 11:59PM

27
#68 - ㅇㅇ / @iliillii_illi

04/16/2022 at 08:40PM

27
#69 - cho / @cho_liaa

04/17/2022 at 08:18AM

27
#70 - 마구니 / @Resiving5_3251

04/17/2022 at 09:50AM

27
#71 - 김승현 / @yellowtip_ksh

04/17/2022 at 11:12AM

27
#72 - 오찬란 / @5chanran

04/17/2022 at 11:15AM

27
#73 - 앙글몽글 / @theloveshe

04/17/2022 at 12:11PM

27
#74 - 구이공 / @CdP60ouZ6hhcHMG

04/17/2022 at 01:25PM

27
#75 - dbswjddms517@naver.com / @wjdwjd0101

04/17/2022 at 01:52PM

27
#76 - warwickrulez / @warwickrulez

04/20/2022 at 07:52PM

27
#77 - Youssef Magdy / @youssef_magdy29

04/27/2022 at 11:08PM

27
#78 - Irakli Chigvaria / @tchigvaria

05/06/2022 at 06:32PM

27
#79 - ShookerAndBeta / @Shooker2012

06/06/2022 at 03:53PM

27
#80 - Martin Bielik / @mabielik

06/07/2022 at 06:37PM

27
#81 - JWei / @JWei9

07/13/2022 at 12:32PM

27
#82 - satetheus-vimgolf / @SVimgolf

07/17/2022 at 04:40AM

27
#83 - Lory / @Lory46845742

07/23/2022 at 08:13AM

27
#84 - Rui Xue / @ruirayxue

08/30/2022 at 05:52AM

27
#85 - Eivind Jahren / @HaskellElephant

09/12/2022 at 07:34PM

27
#86 - sap / @sap38838304

09/27/2022 at 01:49AM

27
#87 - Paradoxskin / @paradoxskin

10/31/2022 at 11:50AM

27
#88 - andrewalker@mastodon.green / @andrewalkernet

11/08/2022 at 02:51PM

27
#89 - Mrmclarrinson / @mrmclarrinson

12/11/2022 at 11:12AM

27
#90 - 0xf00ff00f / @0xf00ff00f

12/13/2022 at 07:56PM