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

491 active golfers, 2048 entries

Leaderboard (lowest score wins):
27
#91 - DW Luna / @dcheed_

12/21/2022 at 01:59PM

27
#92 - でよ / @tada_kun8

01/24/2023 at 03:22AM

27
#93 - 妹様万歳 / @imoutomansai

02/08/2023 at 04:40PM

27
#94 - Yunus Emre Yücel / @_yunusey_

02/21/2023 at 03:03AM

27
#95 - 蛙爹 / @Joe53572723

02/21/2023 at 07:04AM

27
#96 - Bruce Woodward / @b00ffer

03/26/2023 at 03:53AM

27
#97 - 비둘기 / @a7AUna3f37W54Fb

04/04/2023 at 12:29PM

27
#98 - Tanzeel Kazi / @tanzeelkazi

06/21/2023 at 02:52AM

27
#99 - 1 des frr fourmis / @frrfourmi

06/28/2023 at 01:05PM

27
#100 - Bertold E. / @bertold_e66506

07/01/2023 at 09:58AM

27
#101 - わーお / @lwgZVRoOQ8Nf6VG

07/04/2023 at 08:16AM

27
#102 - moh ayaya / @AyayaMoh

08/20/2023 at 02:52PM

27
#103 - naka / @nak38223985244

09/06/2023 at 01:06PM

27
#104 - Monkey Boy / @monkey29089

09/23/2023 at 05:46AM

27
#105 - Luoyb / @Luoyb

10/21/2023 at 05:33AM

27
#106 - bpking1 / @bpking1

11/22/2023 at 01:25AM

27
#107 - lethalNeutrino / @lethalNeutrino

11/28/2023 at 12:44PM

27
#108 - Remus Dalrymple / @bornintheflames

01/01/2024 at 09:05AM

27
#109 - jeffreymrussell / @jeffreymrussell

01/05/2024 at 12:21PM

28
#110 - Taehwa Kang / @teakang

03/19/2022 at 02:38AM

28
#111 - ya-suke / @ysxninja

03/26/2022 at 11:40PM

28
#112 - co_hyo / @co_hyo

04/10/2022 at 04:31PM

28
#113 - 김가윤 / @qweru38010687

04/13/2022 at 11:31AM

28
#114 - JS K / @JSK76504122

04/15/2022 at 01:07PM

28
#115 - 최최대로 / @Jaenedir

04/16/2022 at 09:49AM

28
#116 - ri_O_ri / @ri_Ori_R_yon

04/16/2022 at 03:56PM

28
#117 - // / @jy1231_

04/17/2022 at 08:16AM

28
#118 - 박승민 / @tmdals5512

04/17/2022 at 08:50AM

28
#119 - 정희재 / @jeonghu44213294

04/17/2022 at 10:38AM

28
#120 - jovyn / @jovyn_

05/05/2022 at 03:16PM