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

603 active golfers, 2596 entries

Leaderboard (lowest score wins):
28
#151 - Alexander Curtis / @AlexOnCode

03/24/2023 at 04:46PM

28
#152 - Chun Chanjun / @CChanjun

03/30/2023 at 06:46AM

28
#153 - 이수지 / @iamsoojee

04/05/2023 at 05:07AM

28
#154 - 지선우 / @poom1937

04/08/2023 at 03:38PM

28
#155 - 병선 류 / @mnbv3135bs

04/11/2023 at 12:45PM

28
#156 - Ward Quaghebeur / @WardQuaghebeur

05/24/2023 at 01:12PM

28
#157 - Maarten Craeynest / @Maarten_Cr

06/25/2023 at 07:13PM

28
#158 - samuel erlands / @ErlandsSam52210

08/23/2023 at 10:59AM

28
#159 - scpchicken / @scpchick

10/20/2023 at 09:44PM

28
#160 - tien / @tien40766111

11/13/2023 at 12:36PM

28
#161 - asirago / @asiragoo

12/13/2023 at 10:54AM

28
#162 - Arey125 / @Arey125

01/13/2024 at 08:42PM

28
#163 - Dreb / @drebtchinsky

04/04/2024 at 08:44PM

28
#164 - persona-twotwo / @persona-twotwo

04/08/2024 at 05:52AM

28
#165 - tgYun783 / @tgYun783

04/08/2024 at 12:43PM

28
#166 - HeyJunN / @HeyJunN

04/08/2024 at 02:04PM

28
#167 - kangsancheon / @kangsancheon

04/12/2024 at 12:04PM

28
#168 - Park Min-Heoyk / @TheStupi

04/12/2024 at 06:21PM

28
#169 - jiwon_kim / @Ji1WonKim

04/13/2024 at 11:15AM

28
#170 - qaz2222 / @qaz2222

04/13/2024 at 11:56AM

28
#171 - rkrkrkwk / @rkrkrkwk

04/13/2024 at 04:02PM

28
#172 - suyeon040610 / @suyeon040610

04/14/2024 at 05:50AM

28
#173 - lazely / @lazely

04/14/2024 at 08:23AM

28
#174 - HyoHune / @HyoHune

04/14/2024 at 01:43PM

28
#175 - Tomek / @Madghostek

04/18/2024 at 01:51PM

28
#176 - Petter Hoem Sletsjøe / @petterhs

08/07/2024 at 11:37PM

28
#177 - diskeyd / @diskeyd

04/02/2025 at 11:47AM

29
#178 - 벚꽃 / @beojkkoch3

04/07/2022 at 01:28PM

29
#179 - SofI / @SofI58727266

04/07/2022 at 03:45PM

29
#180 - 최광혁 / @choegwanghyeog4

04/08/2022 at 12:05PM