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

450 active golfers, 1852 entries

Leaderboard (lowest score wins):
28
#121 - brett / @brettyukich

08/31/2022 at 12:47PM

28
#122 - vimgolfer / @vimgolf321

09/19/2022 at 02:02PM

28
#123 - Vlad Yaglamunov / @VladYaglamunov

10/13/2022 at 10:34AM

28
#124 - PoustouFlan / @Poustou_Flan

11/21/2022 at 07:51PM

28
#125 - Arne / @arnkaes

01/16/2023 at 10:03PM

28
#126 - Alexander Curtis / @AlexOnCode

03/24/2023 at 04:46PM

28
#127 - Chun Chanjun / @CChanjun

03/30/2023 at 06:46AM

28
#128 - 이수지 / @iamsoojee

04/05/2023 at 05:07AM

28
#129 - 지선우 / @poom1937

04/08/2023 at 03:38PM

28
#130 - 병선 류 / @mnbv3135bs

04/11/2023 at 12:45PM

28
#131 - Ward Quaghebeur / @WardQuaghebeur

05/24/2023 at 01:12PM

28
#132 - Maarten Craeynest / @Maarten_Cr

06/25/2023 at 07:13PM

28
#133 - samuel erlands / @ErlandsSam52210

08/23/2023 at 10:59AM

29
#134 - 벚꽃 / @beojkkoch3

04/07/2022 at 01:28PM

29
#135 - SofI / @SofI58727266

04/07/2022 at 03:45PM

29
#136 - 최광혁 / @choegwanghyeog4

04/08/2022 at 12:05PM

29
#137 - sapir malka / @sapir5522

04/13/2022 at 10:54AM

29
#138 - 황다민 / @ghkdekals

04/15/2022 at 06:57PM

29
#139 - gugik / @rafgugi

04/25/2022 at 02:21AM

29
#140 - noname / @1____NULL____0

04/26/2022 at 08:53PM

29
#141 - sdfghjk / @sdfghjk88424595

04/27/2022 at 10:55PM

29
#142 - Lyren Brown / @LyrenBrown

05/01/2022 at 08:38AM

29
#143 - Javier Contreras / @contranton

05/04/2022 at 12:13AM

29
#144 - Edoardo Signorini / @Edoars

05/08/2022 at 08:42AM

29
#145 - xadrta / @xadrta

05/09/2022 at 04:10PM

29
#146 - Jakub Parapura / @JakubParapura

05/22/2022 at 06:55AM

29
#147 - Regan Tackett / @arrowtackett

05/30/2022 at 12:21AM

29
#148 - YaruCar / @yaru_car

06/03/2022 at 01:29PM

29
#149 - Ivo Blöchliger / @aigledesalpes

06/05/2022 at 09:13PM

29
#150 - Arthur DELORT / @artDelort

06/15/2022 at 03:10PM