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):
36
#211 - vimgolfaccfekxh / @vimgolfaccfekxh

09/28/2022 at 07:58PM

36
#212 - steve / @steve35773420

11/19/2022 at 03:09PM

37
#213 - Clmi / @c_decaf

04/08/2022 at 07:28AM

37
#214 - ccorvi / @ccorvi1

05/16/2022 at 03:29PM

37
#215 - kovapi3088@serosin.com / @test39654481

06/22/2022 at 03:13PM

37
#216 - adrian / @adrian09610908

08/08/2022 at 04:25AM

37
#217 - Moritz Kraus / @MoritzKraus4

09/03/2022 at 06:13PM

37
#218 - Vim Golf / @Golf4Vim

10/30/2022 at 07:24PM

38
#219 - Nougatine Naja / @NougatineNaja

03/22/2022 at 12:15PM

38
#220 - Jason Kuan | jasonkuan.eth / @Jason9075Kuan

04/03/2022 at 10:04AM

38
#221 - Eric Wannemacher / @ericwannemacher

04/03/2022 at 10:57PM

38
#222 - Alex / @AlexanderHeatl2

05/21/2022 at 08:47PM

38
#223 - happy cola / @ccolahappy

06/11/2022 at 07:16PM

38
#224 - Kiran Rajpurohit / @KiranClose

07/30/2022 at 03:44PM

39
#225 - Emil / @emilklindt

04/04/2022 at 04:03PM

39
#226 - Justin Sane / @Here4Vimgolf

04/22/2022 at 02:13PM

39
#227 - Allen Li / @thenightawl

05/04/2022 at 03:54AM

39
#228 - jofene / @jofene2

05/07/2022 at 08:50AM

39
#229 - corei8 / @Corei8Github

05/14/2022 at 07:05PM

39
#230 - koppa / @4koppa

05/21/2022 at 04:08PM

39
#231 - rando bando / @randoba40946238

06/24/2022 at 01:53AM

39
#232 - John Huynh / @huynh_j93

12/05/2022 at 08:22PM

40
#233 - Camille 🌷 / @StupideCamille

04/08/2022 at 08:03AM

40
#234 - Chinmay Dalal / @p00fd

05/05/2022 at 08:17AM

40
#235 - T. Arch / @TArch76864215

06/09/2022 at 07:02PM

40
#236 - pady. 🇪🇺 / @hundertzwoelf_

11/12/2022 at 07:56PM

41
#237 - mebuh / @mebuh42

03/22/2022 at 08:16PM

41
#238 - スティーン@ニーツ / @raxmur

04/21/2022 at 09:27AM

41
#239 - Eric Xue / @ericxues

05/15/2022 at 01:46AM

41
#240 - vin / @vin7654321

06/04/2022 at 09:42AM