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):
39
#391 - Allen Li / @thenightawl

05/04/2022 at 03:54AM

39
#392 - jofene / @jofene2

05/07/2022 at 08:50AM

39
#393 - corei8 / @Corei8Github

05/14/2022 at 07:05PM

39
#394 - koppa / @4koppa

05/21/2022 at 04:08PM

39
#395 - rando bando / @randoba40946238

06/24/2022 at 01:53AM

39
#396 - 马海洋 / @LG41bT7ZvqOdFl3

02/07/2023 at 04:57AM

39
#397 - rayx / @ray-x

12/02/2023 at 07:36AM

39
#398 - ishj00 / @ishj00

04/01/2025 at 02:16PM

40
#399 - Camille 🌷 / @StupideCamille

04/08/2022 at 08:03AM

40
#400 - Chinmay Dalal / @p00fd

05/05/2022 at 08:17AM

40
#401 - T. Arch / @TArch76864215

06/09/2022 at 07:02PM

40
#402 - pady. 🇪🇺 @hundertzwoelf@sueden.social / @hundertzwoelf_

11/12/2022 at 07:56PM

40
#403 - Alexandre Ignjatovic / @bankair

01/23/2023 at 11:30AM

40
#404 - Sylvain Dangin / @Sylvaner03

02/25/2023 at 08:12PM

40
#405 - DS / @DSVGOLF

04/06/2023 at 12:18PM

40
#406 - gvnnn / @gvnnn

12/07/2023 at 10:40PM

40
#407 - TANN1N / @TANN1N

04/12/2024 at 07:59AM

40
#408 - Austin Abell / @austinabell

06/29/2024 at 08:46PM

40
#409 - LukasOates / @LukasOates

07/19/2024 at 11:56AM

40
#410 - Tyler Tivadar / @tylertiv

08/24/2024 at 06:25PM

40
#411 - Diwakar Singh Parmar / @parmardiwakar150

08/26/2024 at 06:28PM

40
#412 - kokame / @tohiraoka

08/31/2024 at 03:55PM

40
#413 - Geon Woo Lee / @mystlee

03/25/2025 at 05:30PM

41
#414 - mebuh / @mebuh42

03/22/2022 at 08:16PM

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

04/21/2022 at 09:27AM

41
#416 - Eric Xue / @ericxues

05/15/2022 at 01:46AM

41
#417 - vin / @vin7654321

06/04/2022 at 09:42AM

41
#418 - xtncl / @xtncl

06/10/2022 at 08:43PM

41
#419 - Einn Seinn / @EinnSeinn

08/04/2022 at 02:25PM

41
#420 - Derek Salerno / @dsalernodev

12/01/2022 at 09:31PM