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

418 active golfers, 1728 entries

Leaderboard (lowest score wins):
27
#91 - 비둘기 / @a7AUna3f37W54Fb

04/04/2023 at 12:29PM

28
#92 - Taehwa Kang / @teakang

03/19/2022 at 02:38AM

28
#93 - ya-suke / @ninja__01

03/26/2022 at 11:40PM

28
#94 - co_hyo / @co_hyo

04/10/2022 at 04:31PM

28
#95 - 김가윤 / @qweru38010687

04/13/2022 at 11:31AM

28
#96 - JS K / @JSK76504122

04/15/2022 at 01:07PM

28
#97 - 최최대로 / @Jaenedir

04/16/2022 at 09:49AM

28
#98 - ri_O_ri / @ri_Ori_R_yon

04/16/2022 at 03:56PM

28
#99 - // / @jy1231_

04/17/2022 at 08:16AM

28
#100 - 박승민 / @tmdals5512

04/17/2022 at 08:50AM

28
#101 - 정희재 / @jeonghu44213294

04/17/2022 at 10:38AM

28
#102 - jovyn / @jovyn_

05/05/2022 at 03:16PM

28
#103 - ksvorfsha / @ksvorfsha

05/14/2022 at 01:31AM

28
#104 - funky_koval / @iam_funky_koval

05/15/2022 at 01:14PM

28
#105 - Xiaohuan Ye / @ikmijkk7

05/24/2022 at 03:53PM

28
#106 - MortalityCure / @MortalityCure

06/14/2022 at 11:01PM

28
#107 - Jean Dupouy / @Izeau

06/16/2022 at 01:23PM

28
#108 - TimMcGuire / @mcguire

06/24/2022 at 03:44PM

28
#109 - Mens Jender / @m3nder__

08/05/2022 at 11:51AM

28
#110 - Desentcare / @ashuyali

08/25/2022 at 06:00AM

28
#111 - Alexander Brömmer / @Superbort

08/25/2022 at 03:07PM

28
#112 - brett / @brettyukich

08/31/2022 at 12:47PM

28
#113 - vimgolfer / @vimgolf321

09/19/2022 at 02:02PM

28
#114 - Vlad Yaglamunov / @VladYaglamunov

10/13/2022 at 10:34AM

28
#115 - PoustouFlan / @Poustou_Flan

11/21/2022 at 07:51PM

28
#116 - Arne / @arnkaes

01/16/2023 at 10:03PM

28
#117 - Alexander Curtis / @AlexOnCode

03/24/2023 at 04:46PM

28
#118 - Chun Chanjun / @CChanjun

03/30/2023 at 06:46AM

28
#119 - 이수지 / @iamsoojee

04/05/2023 at 05:07AM

28
#120 - 지선우 / @poom1937

04/08/2023 at 03:38PM