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):
35
#331 - Lars Winderling / @kaHaleMaKai

11/28/2022 at 08:23PM

35
#332 - Ryuichiroh Ikeuchi / @ryuichiroh_ike

11/30/2022 at 03:27PM

35
#333 - AIUEHARA / @AIUEHARA15

12/04/2022 at 02:07PM

35
#334 - Ringel Natter / @SenorTenor

02/10/2023 at 11:15PM

35
#335 - RosaTryp / @RosaTryp

03/10/2023 at 03:19PM

35
#336 - 💗 / @Vfhwk847bd

04/14/2023 at 06:21AM

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

08/11/2023 at 06:36PM

35
#338 - Anako Jeannin-Mallet / @anakojm

11/12/2023 at 01:51PM

35
#339 - Ryan Kilpadi / @rkilpadi

03/03/2024 at 05:57AM

35
#340 - wihinenh / @wihinenh

04/06/2024 at 07:53PM

35
#341 - Mystic / @aw0D5RUrdmxsylt

04/13/2024 at 07:30PM

35
#342 - yge / @card-yun

04/14/2024 at 10:13AM

35
#343 - jhjhjhoh / @jhjhjhoh

04/14/2024 at 01:36PM

35
#344 - Jan Musílek / @stinovlas

06/12/2024 at 12:39PM

35
#345 - Alex Khakhlyuk / @khakhlyuk

08/26/2024 at 07:10PM

35
#346 - hanhub21 / @hanhub21

03/27/2025 at 11:36AM

36
#347 - Andrew Savino / @AndrewSavino5

03/24/2022 at 08:56PM

36
#348 - rr / @rodgeur31

03/28/2022 at 10:13PM

36
#349 - anonymouse / @anonymo65837183

04/03/2022 at 04:30PM

36
#350 - aravindthangavel / @aravindpt

04/20/2022 at 12:47AM

36
#351 - Systemfehler / @Systemerror7A69

05/12/2022 at 05:04PM

36
#352 - vanniuner / @vanniuner

05/18/2022 at 12:59AM

36
#353 - Robberechts Arne / @ArneRobberechts

05/22/2022 at 11:17AM

36
#354 - samsepiol / @samsepi81094451

07/08/2022 at 12:57PM

36
#355 - Van / @dangtrivan15

09/11/2022 at 10:13AM

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

09/21/2022 at 03:26AM

36
#357 - vimgolfaccfekxh / @vimgolfaccfekxh

09/28/2022 at 07:58PM

36
#358 - steve / @steve35773420

11/19/2022 at 03:09PM

36
#359 - Francois Marais / @maraisf

10/11/2023 at 05:17PM

36
#360 - jpggpj / @jpggpj

12/10/2023 at 12:24PM