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

377 active golfers, 1525 entries

Leaderboard (lowest score wins):
50
#301 - Jerry Liu / @JoelJoshanX

06/02/2022 at 01:55AM

50
#302 - Andy Tso / @AndyTso7

07/11/2022 at 12:06AM

50
#303 - Brandon Banks / @brandonmbanks

11/19/2022 at 03:08AM

51
#304 - Gunter Kluge / @KlugeGunter

04/05/2022 at 03:07PM

51
#305 - meleu.sh / @meleushell

05/06/2022 at 03:21PM

51
#306 - Eric Briand / @eric_briand

05/12/2022 at 07:16AM

51
#307 - dogmeat / @dogmeat11

05/24/2022 at 09:44AM

52
#308 - Sithe / @SitheTie

05/05/2022 at 10:09PM

52
#309 - sjosbbfkd / @sjosbbfkd

05/15/2022 at 06:09AM

52
#310 - Denis / @swmmci

06/28/2022 at 11:00PM

52
#311 - Joe Bushi / @joebushi

12/01/2022 at 12:32AM

53
#312 - 강태화 / @kangtaehwa1234

03/18/2022 at 07:57AM

53
#313 - Ed / @Ed43907641

04/05/2022 at 04:34PM

53
#314 - Kyle Channer / @KyleC_Designs

05/27/2022 at 10:14PM

53
#315 - Zachary Peterson / @zpeterson16

07/27/2022 at 11:50AM

54
#316 - William / @williamwjh

04/11/2022 at 05:37PM

54
#317 - Alvaro Neto / @AlvaroN15101725

05/05/2022 at 05:08AM

54
#318 - sakura / @sakura79856991

06/01/2022 at 11:06AM

54
#319 - Nicolas Kreutzer / @NigiCereal

06/13/2022 at 07:18AM

55
#320 - Nakula Neeraje / @nakula_neeraje

04/08/2022 at 08:50PM

55
#321 - Meshan Naidoo / @realmeshan

10/24/2022 at 07:57AM

55
#322 - Thomas 🏴 / @ThomasGrgrczk

11/19/2022 at 11:44AM

56
#323 - Carlos Gracia / @Elrauk

04/08/2022 at 10:03AM

56
#324 - Karl Marx / @Xura_Kurtanidze

04/26/2022 at 11:17AM

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

06/20/2022 at 06:09AM

57
#326 - yash / @ygaitonde

11/25/2022 at 05:16PM

57
#327 - Daniel Nettelfield / @DNIIBOY

12/11/2022 at 09:37PM

58
#328 - Richard / @ohheyrj_

07/13/2022 at 10:52PM

58
#329 - Himanshu Tank / @himanshutank75

10/16/2022 at 02:25PM

60
#330 - Pin / @pinefule

04/05/2022 at 04:55AM