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

550 active golfers, 2373 entries

Leaderboard (lowest score wins):
28
#121 - ya-suke / @ysxninja

03/26/2022 at 11:40PM

28
#122 - co_hyo / @co_hyo

04/10/2022 at 04:31PM

28
#123 - 김가윤 / @qweru38010687

04/13/2022 at 11:31AM

28
#124 - JS K / @JSK76504122

04/15/2022 at 01:07PM

28
#125 - 최최대로 / @Jaenedir

04/16/2022 at 09:49AM

28
#126 - ri_O_ri / @ri_Ori_R_yon

04/16/2022 at 03:56PM

28
#127 - // / @jy1231_

04/17/2022 at 08:16AM

28
#128 - 박승민 / @tmdals5512

04/17/2022 at 08:50AM

28
#129 - 정희재 / @jeonghu44213294

04/17/2022 at 10:38AM

28
#130 - jovyn / @jovyn_

05/05/2022 at 03:16PM

28
#131 - ksvorfsha / @ksvorfsha

05/14/2022 at 01:31AM

28
#132 - funky_koval / @iam_funky_koval

05/15/2022 at 01:14PM

28
#133 - Xiaohuan Ye / @ikmijkk7

05/24/2022 at 03:53PM

28
#134 - MortalityCure / @MortalityCure

06/14/2022 at 11:01PM

28
#135 - Jean Dupouy / @Izeau

06/16/2022 at 01:23PM

28
#136 - TimMcGuire / @mcguire

06/24/2022 at 03:44PM

28
#137 - Mens Jender / @m3nder__

08/05/2022 at 11:51AM

28
#138 - Desentcare / @ashuyali

08/25/2022 at 06:00AM

28
#139 - Alexander Brömmer / @Superbort

08/25/2022 at 03:07PM

28
#140 - brett / @brettyukich

08/31/2022 at 12:47PM

28
#141 - vimgolfer / @vimgolf321

09/19/2022 at 02:02PM

28
#142 - Vlad Yaglamunov / @VladYaglamunov

10/13/2022 at 10:34AM

28
#143 - PoustouFlan / @Poustou_Flan

11/21/2022 at 07:51PM

28
#144 - Arne / @arnkaes

01/16/2023 at 10:03PM

28
#145 - Alexander Curtis / @AlexOnCode

03/24/2023 at 04:46PM

28
#146 - Chun Chanjun / @CChanjun

03/30/2023 at 06:46AM

28
#147 - 이수지 / @iamsoojee

04/05/2023 at 05:07AM

28
#148 - 지선우 / @poom1937

04/08/2023 at 03:38PM

28
#149 - 병선 류 / @mnbv3135bs

04/11/2023 at 12:45PM

28
#150 - Ward Quaghebeur / @WardQuaghebeur

05/24/2023 at 01:12PM