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

550 active golfers, 2373 entries

Leaderboard (lowest score wins):
28
#151 - Maarten Craeynest / @Maarten_Cr

06/25/2023 at 07:13PM

28
#152 - samuel erlands / @ErlandsSam52210

08/23/2023 at 10:59AM

28
#153 - scpchicken / @scpchick

10/20/2023 at 09:44PM

28
#154 - tien / @tien40766111

11/13/2023 at 12:36PM

28
#155 - asirago / @asiragoo

12/13/2023 at 10:54AM

28
#156 - Arey125 / @Arey125

01/13/2024 at 08:42PM

28
#157 - Dreb / @drebtchinsky

04/04/2024 at 08:44PM

28
#158 - persona-twotwo / @persona-twotwo

04/08/2024 at 05:52AM

28
#159 - tgYun783 / @tgYun783

04/08/2024 at 12:43PM

28
#160 - HeyJunN / @HeyJunN

04/08/2024 at 02:04PM

28
#161 - kangsancheon / @kangsancheon

04/12/2024 at 12:04PM

28
#162 - Park Min-Heoyk / @TheStupi

04/12/2024 at 06:21PM

28
#163 - jiwon_kim / @Ji1WonKim

04/13/2024 at 11:15AM

28
#164 - qaz2222 / @qaz2222

04/13/2024 at 11:56AM

28
#165 - rkrkrkwk / @rkrkrkwk

04/13/2024 at 04:02PM

28
#166 - suyeon040610 / @suyeon040610

04/14/2024 at 05:50AM

28
#167 - lazely / @lazely

04/14/2024 at 08:23AM

28
#168 - HyoHune / @HyoHune

04/14/2024 at 01:43PM

28
#169 - Tomek / @Madghostek

04/18/2024 at 01:51PM

29
#170 - 벚꽃 / @beojkkoch3

04/07/2022 at 01:28PM

29
#171 - SofI / @SofI58727266

04/07/2022 at 03:45PM

29
#172 - 최광혁 / @choegwanghyeog4

04/08/2022 at 12:05PM

29
#173 - sapir malka / @sapir5522

04/13/2022 at 10:54AM

29
#174 - 황다민 / @ghkdekals

04/15/2022 at 06:57PM

29
#175 - gugik / @rafgugi

04/25/2022 at 02:21AM

29
#176 - noname / @1____NULL____0

04/26/2022 at 08:53PM

29
#177 - sdfghjk / @sdfghjk88424595

04/27/2022 at 10:55PM

29
#178 - Lyren Brown / @LyrenBrown

05/01/2022 at 08:38AM

29
#179 - Javier Contreras / @contranton

05/04/2022 at 12:13AM

29
#180 - Edoardo Signorini / @Edoars

05/08/2022 at 08:42AM