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

393 active golfers, 1575 entries

Leaderboard (lowest score wins):
54
#331 - sakura / @sakura79856991

06/01/2022 at 11:06AM

54
#332 - Nicolas Kreutzer / @NigiCereal

06/13/2022 at 07:18AM

55
#333 - Nakula Neeraje / @nakula_neeraje

04/08/2022 at 08:50PM

55
#334 - Meshan Naidoo / @realmeshan

10/24/2022 at 07:57AM

55
#335 - Thomas 🏴 / @ThomasGrgrczk

11/19/2022 at 11:44AM

56
#336 - Carlos Gracia / @Elrauk

04/08/2022 at 10:03AM

56
#337 - Karl Marx / @Xura_Kurtanidze

04/26/2022 at 11:17AM

57
#338 - Хью Джолли / @DzolliH

06/20/2022 at 06:09AM

57
#339 - yash / @ygaitonde

11/25/2022 at 05:16PM

57
#340 - Daniel Nettelfield / @DNIIBOY

12/11/2022 at 09:37PM

58
#341 - Richard / @ohheyrj_

07/13/2022 at 10:52PM

58
#342 - Himanshu Tank / @himanshutank75

10/16/2022 at 02:25PM

60
#343 - Pin / @pinefule

04/05/2022 at 04:55AM

61
#344 - ylv / @ylv_io

04/01/2022 at 09:54PM

61
#345 - Pham Tuan Anh / @anhpt379

07/10/2022 at 10:52AM

62
#346 - Alan Rezende 🔥 Full Stack Developer / @alanrezende

04/30/2022 at 08:02PM

62
#347 - Alex Liu / @liualexliualex

05/21/2022 at 07:09AM

62
#348 - djheidihoe / @djheidihoe1

07/18/2022 at 10:01PM

63
#349 - gohuorse / @go_hourse

05/21/2022 at 02:32PM

63
#350 - Thomas Hiron / @thomashiron

02/20/2023 at 10:45AM

64
#351 - Alexander Ruiztagle / @aruiz_tagle

11/24/2022 at 10:48AM

65
#352 - Raimondas Kazlauskas / @RhymondK

03/28/2022 at 02:17PM

65
#353 - Cyrus Kirk / @cyrusjkirk

02/02/2023 at 03:17PM

66
#354 - Gregory Bleiker / @gregory_bleiker

03/23/2022 at 01:52PM

66
#355 - Milan Gunasekera / @GunasekeraMilan

03/30/2022 at 08:41AM

66
#356 - Sean Corr / @seanc01212

06/04/2022 at 06:16PM

66
#357 - Ty Harlacker / @tizzleh

10/22/2022 at 12:35AM

67
#358 - Abhijeet Bodas / @apbodas

10/30/2022 at 04:58PM

68
#359 - D G G / @DGJourneyman

02/20/2023 at 11:12AM

70
#360 - Eric Wennerberg / @ericwenn

03/20/2022 at 03:50PM