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):
52
#511 - Dyl-DawG / @ScribeDylDawG

02/27/2023 at 08:17PM

53
#512 - 강태화 / @kangtaehwa1234

03/18/2022 at 07:57AM

53
#513 - Ed / @Ed43907641

04/05/2022 at 04:34PM

53
#514 - Kyle Channer / @KyleC_Designs

05/27/2022 at 10:14PM

53
#515 - Zachary Peterson / @zpeterson16

07/27/2022 at 11:50AM

53
#516 - user113333 / @user113333

05/13/2024 at 01:31PM

54
#517 - William / @williamwjh

04/11/2022 at 05:37PM

54
#518 - Alvaro Neto / @AlvaroN15101725

05/05/2022 at 05:08AM

54
#519 - sakura / @sakura79856991

06/01/2022 at 11:06AM

54
#520 - Nicolas Kreutzer / @NigiCereal

06/13/2022 at 07:18AM

55
#521 - Nakula Neeraje / @nakula_neeraje

04/08/2022 at 08:50PM

55
#522 - Meshan Naidoo / @realmeshan

10/24/2022 at 07:57AM

55
#523 - Thomas 🏴 / @ThomasGrgrczk

11/19/2022 at 11:44AM

56
#524 - Carlos Gracia / @Elrauk

04/08/2022 at 10:03AM

56
#525 - Karl Marx / @Xura_Kurtanidze

04/26/2022 at 11:17AM

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

06/20/2022 at 06:09AM

57
#527 - yash / @ygaitonde

11/25/2022 at 05:16PM

57
#528 - Daniel Nettelfield / @DNIIBOY

12/11/2022 at 09:37PM

57
#529 - QKSDM / @qksdm

01/26/2024 at 04:25PM

57
#530 - Kanmuruuruu / @Kanmuruuruu

04/04/2024 at 07:03PM

57
#531 - Elliot Schemmel / @regulated

10/07/2024 at 06:22PM

58
#532 - Richard / @ohheyrj_

07/13/2022 at 10:52PM

58
#533 - Himanshu Tank / @himanshutank75

10/16/2022 at 02:25PM

58
#534 - owner / @owner87643936

04/24/2023 at 12:36PM

60
#535 - Pin / @pinefule

04/05/2022 at 04:55AM

61
#536 - ylv / @ylv_io

04/01/2022 at 09:54PM

61
#537 - Pham Tuan Anh / @anhpt379

07/10/2022 at 10:52AM

61
#538 - hyunw0n / @hyunw0n

04/13/2024 at 07:15AM

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

04/30/2022 at 08:02PM

62
#540 - Alex Liu / @liualexliualex

05/21/2022 at 07:09AM