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

587 active golfers, 2540 entries

Leaderboard (lowest score wins):
35
#331 - 💗 / @Vfhwk847bd

04/14/2023 at 06:21AM

35
#332 - YaaO - you are an original / @RolfNyffenegger

08/11/2023 at 06:36PM

35
#333 - Anako Jeannin-Mallet / @anakojm

11/12/2023 at 01:51PM

35
#334 - Ryan Kilpadi / @rkilpadi

03/03/2024 at 05:57AM

35
#335 - wihinenh / @wihinenh

04/06/2024 at 07:53PM

35
#336 - Mystic / @aw0D5RUrdmxsylt

04/13/2024 at 07:30PM

35
#337 - yge / @card-yun

04/14/2024 at 10:13AM

35
#338 - jhjhjhoh / @jhjhjhoh

04/14/2024 at 01:36PM

35
#339 - Jan Musílek / @stinovlas

06/12/2024 at 12:39PM

35
#340 - Alex Khakhlyuk / @khakhlyuk

08/26/2024 at 07:10PM

36
#341 - Andrew Savino / @AndrewSavino5

03/24/2022 at 08:56PM

36
#342 - rr / @rodgeur31

03/28/2022 at 10:13PM

36
#343 - anonymouse / @anonymo65837183

04/03/2022 at 04:30PM

36
#344 - aravindthangavel / @aravindpt

04/20/2022 at 12:47AM

36
#345 - Systemfehler / @Systemerror7A69

05/12/2022 at 05:04PM

36
#346 - vanniuner / @vanniuner

05/18/2022 at 12:59AM

36
#347 - Robberechts Arne / @ArneRobberechts

05/22/2022 at 11:17AM

36
#348 - samsepiol / @samsepi81094451

07/08/2022 at 12:57PM

36
#349 - Van / @dangtrivan15

09/11/2022 at 10:13AM

36
#350 - キムラ・OPEL・ユウジ / @kimurayuuji79

09/21/2022 at 03:26AM

36
#351 - vimgolfaccfekxh / @vimgolfaccfekxh

09/28/2022 at 07:58PM

36
#352 - steve / @steve35773420

11/19/2022 at 03:09PM

36
#353 - Francois Marais / @maraisf

10/11/2023 at 05:17PM

36
#354 - jpggpj / @jpggpj

12/10/2023 at 12:24PM

36
#355 - Pieter-Jan Lavaerts / @Pumpkin_Pie_Eat

03/19/2024 at 09:49AM

36
#356 - Casper Wong / @CasperWong-jpg

04/05/2024 at 03:27AM

36
#357 - constap / @constap

04/19/2024 at 03:24PM

36
#358 - Martin Harvan / @martinhrvn

06/06/2024 at 08:40PM

37
#359 - Clmi / @c_decaf

04/08/2022 at 07:28AM

37
#360 - ccorvi / @ccorvi1

05/16/2022 at 03:29PM