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):
27
#121 - tk555 / @tk55513

05/04/2024 at 01:47AM

27
#122 - James Tan / @jamesbtan

05/07/2024 at 12:33PM

27
#123 - imperatormatthias / @imperatormatthias

06/16/2024 at 03:54PM

27
#124 - lc-hanxi / @lc-hanxi

08/18/2024 at 08:23AM

27
#125 - kanguk123 / @kanguk123

03/31/2025 at 12:57PM

28
#126 - Taehwa Kang / @teakang

03/19/2022 at 02:38AM

28
#127 - ya-suke / @ysxninja

03/26/2022 at 11:40PM

28
#128 - co_hyo / @co_hyo

04/10/2022 at 04:31PM

28
#129 - 김가윤 / @qweru38010687

04/13/2022 at 11:31AM

28
#130 - JS K / @JSK76504122

04/15/2022 at 01:07PM

28
#131 - 최최대로 / @Jaenedir

04/16/2022 at 09:49AM

28
#132 - ri_O_ri / @ri_Ori_R_yon

04/16/2022 at 03:56PM

28
#133 - // / @jy1231_

04/17/2022 at 08:16AM

28
#134 - 박승민 / @tmdals5512

04/17/2022 at 08:50AM

28
#135 - 정희재 / @jeonghu44213294

04/17/2022 at 10:38AM

28
#136 - jovyn / @jovyn_

05/05/2022 at 03:16PM

28
#137 - ksvorfsha / @ksvorfsha

05/14/2022 at 01:31AM

28
#138 - funky_koval / @iam_funky_koval

05/15/2022 at 01:14PM

28
#139 - Xiaohuan Ye / @ikmijkk7

05/24/2022 at 03:53PM

28
#140 - MortalityCure / @MortalityCure

06/14/2022 at 11:01PM

28
#141 - Jean Dupouy / @Izeau

06/16/2022 at 01:23PM

28
#142 - TimMcGuire / @mcguire

06/24/2022 at 03:44PM

28
#143 - Mens Jender / @m3nder__

08/05/2022 at 11:51AM

28
#144 - Desentcare / @ashuyali

08/25/2022 at 06:00AM

28
#145 - Alexander Brömmer / @Superbort

08/25/2022 at 03:07PM

28
#146 - brett / @brettyukich

08/31/2022 at 12:47PM

28
#147 - vimgolfer / @vimgolf321

09/19/2022 at 02:02PM

28
#148 - Vlad Yaglamunov / @VladYaglamunov

10/13/2022 at 10:34AM

28
#149 - PoustouFlan / @Poustou_Flan

11/21/2022 at 07:51PM

28
#150 - Arne / @arnkaes

01/16/2023 at 10:03PM