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):
29
#181 - sapir malka / @sapir5522

04/13/2022 at 10:54AM

29
#182 - 황다민 / @ghkdekals

04/15/2022 at 06:57PM

29
#183 - gugik / @rafgugi

04/25/2022 at 02:21AM

29
#184 - noname / @1____NULL____0

04/26/2022 at 08:53PM

29
#185 - sdfghjk / @sdfghjk88424595

04/27/2022 at 10:55PM

29
#186 - Lyren Brown / @LyrenBrown

05/01/2022 at 08:38AM

29
#187 - Javier Contreras / @contranton

05/04/2022 at 12:13AM

29
#188 - Edoardo Signorini / @Edoars

05/08/2022 at 08:42AM

29
#189 - xadrta / @xadrta

05/09/2022 at 04:10PM

29
#190 - Jakub Parapura / @JakubParapura

05/22/2022 at 06:55AM

29
#191 - Regan Tackett / @arrowtackett

05/30/2022 at 12:21AM

29
#192 - YaruCar / @yaru_car

06/03/2022 at 01:29PM

29
#193 - Ivo Blöchliger / @aigledesalpes

06/05/2022 at 09:13PM

29
#194 - Arthur DELORT / @artDelort

06/15/2022 at 03:10PM

29
#195 - Siddharth Murali / @SidTweetsALess

06/24/2022 at 10:08AM

29
#196 - 小山内まい / @osanamity

07/13/2022 at 08:55AM

29
#197 - nauj / @nauj_w

07/29/2022 at 05:49AM

29
#198 - bastien batardier / @supercamarche

10/07/2022 at 05:40PM

29
#199 - Dank City / @ddankcity

12/04/2022 at 10:52PM

29
#200 - Marco Meinardi / @Kee__no

12/29/2022 at 02:51PM

29
#201 - Ivan Trepakov / @liontiger23

12/30/2022 at 04:23PM

29
#202 - usermod / @g_usermod

02/06/2023 at 12:10AM

29
#203 - James Harvey / @JimmyJamesII

02/12/2023 at 12:46AM

29
#204 - Patrykduda / @Patrykduda17

03/13/2023 at 07:34PM

29
#205 - Sergey Efimochkin / @insanefingers

03/28/2023 at 03:23PM

29
#206 - John Huynh / @huynh_j93

03/30/2023 at 06:35PM

29
#207 - Glorbo / @GlorbyGlorbo

03/31/2023 at 04:12AM

29
#208 - 성우 / @seongu85669455

04/03/2023 at 04:29PM

29
#209 - 권민재 / @gommj0611

04/07/2023 at 08:27AM

29
#210 - 타장령단 / @tj_rd808

04/10/2023 at 02:31AM