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

351 active golfers, 1432 entries

Leaderboard (lowest score wins):
28
#91 - jovyn / @jovyn_

05/05/2022 at 03:16PM

28
#92 - ksvorfsha / @ksvorfsha

05/14/2022 at 01:31AM

28
#93 - funky_koval / @iam_funky_koval

05/15/2022 at 01:14PM

28
#94 - Xiaohuan Ye / @ikmijkk7

05/24/2022 at 03:53PM

28
#95 - MortalityCure / @MortalityCure

06/14/2022 at 11:01PM

28
#96 - Jean Dupouy / @Izeau

06/16/2022 at 01:23PM

28
#97 - TimMcGuire / @mcguire

06/24/2022 at 03:44PM

28
#98 - Mens Jender / @m3nder__

08/05/2022 at 11:51AM

28
#99 - Desentcare / @ashuyali

08/25/2022 at 06:00AM

28
#100 - Alexander Brömmer / @Superbort

08/25/2022 at 03:07PM

28
#101 - brett / @brettyukich

08/31/2022 at 12:47PM

28
#102 - vimgolfer / @vimgolf321

09/19/2022 at 02:02PM

28
#103 - Vlad Yaglamunov / @VladYaglamunov

10/13/2022 at 10:34AM

28
#104 - PoustouFlan / @Poustou_Flan

11/21/2022 at 07:51PM

29
#105 - 벚꽃 / @beojkkoch3

04/07/2022 at 01:28PM

29
#106 - SofI / @SofI58727266

04/07/2022 at 03:45PM

29
#107 - 최광혁 / @choegwanghyeog4

04/08/2022 at 12:05PM

29
#108 - sapir malka / @sapir5522

04/13/2022 at 10:54AM

29
#109 - 황다민 / @ghkdekals

04/15/2022 at 06:57PM

29
#110 - gugik / @rafgugi

04/25/2022 at 02:21AM

29
#111 - noname / @1____NULL____0

04/26/2022 at 08:53PM

29
#112 - sdfghjk / @sdfghjk88424595

04/27/2022 at 10:55PM

29
#113 - Lyren Brown / @LyrenBrown

05/01/2022 at 08:38AM

29
#114 - Javier Contreras / @contranton

05/04/2022 at 12:13AM

29
#115 - Edoardo Signorini / @Edoars

05/08/2022 at 08:42AM

29
#116 - xadrta / @xadrta

05/09/2022 at 04:10PM

29
#117 - Jakub Parapura / @JakubParapura

05/22/2022 at 06:55AM

29
#118 - Regan Tackett / @arrowtackett

05/30/2022 at 12:21AM

29
#119 - YaruCar / @yaru_car

06/03/2022 at 01:29PM

29
#120 - Ivo Blöchliger / @aigledesalpes

06/05/2022 at 09:13PM