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

589 active golfers, 2544 entries

Leaderboard (lowest score wins):
34
#301 - Tunian Grey / @salmonianpink

02/26/2023 at 02:02PM

34
#302 - hex / @hexneth

02/26/2023 at 11:35PM

34
#303 - Fabio Ortega / @_Ortega

04/05/2023 at 06:27AM

34
#304 - Derek Schrock / @derekschrock

04/11/2023 at 10:54PM

34
#305 - wemgulf / @wemgulfer

11/02/2023 at 02:16PM

34
#306 - George Angelopoulos / @gangelop

02/17/2024 at 06:35AM

34
#307 - Panda-Ghost / @Panda-Ghost

02/23/2024 at 07:17AM

34
#308 - Rodney Visser / @_Radnus

04/05/2024 at 02:58PM

34
#309 - Johannes / @Xydez

07/10/2024 at 09:14PM

34
#310 - Henry Liu / @henryliu5

09/01/2024 at 05:56PM

35
#311 - Mark Blakeney / @bulletmark

03/18/2022 at 01:35AM

35
#312 - Alan. / @yisusalan

03/21/2022 at 04:41AM

35
#313 - pusha t daily / @rudellius

04/08/2022 at 09:02PM

35
#314 - Muziek voor Meloenen / @VoorMeloenen

04/13/2022 at 02:51PM

35
#315 - 할핳 / @vimgolfYOUNG

04/16/2022 at 05:08AM

35
#316 - Ragtime / @TheRagtimeBlues

05/05/2022 at 06:33PM

35
#317 - compter651 / @compter651

06/04/2022 at 10:11AM

35
#318 - Benjamin Verjus / @Tart0f

07/03/2022 at 11:55PM

35
#319 - Guilherme Lima / @guilima10

08/09/2022 at 06:05PM

35
#320 - Léo / @Leo58369183

08/22/2022 at 10:40AM

35
#321 - Ratkovszki István / @RatkovszkiIstvn

09/05/2022 at 01:19PM

35
#322 - Dr. Peťko / @PetkoDr

09/13/2022 at 05:26AM

35
#323 - Oleg Olesinski / @hex0n1

09/18/2022 at 09:53PM

35
#324 - LordPax / @LordPompax

10/04/2022 at 05:37PM

35
#325 - #шлюхаиспания #majoriesMàgiques / @Mo66452567

10/27/2022 at 04:41PM

35
#326 - Lars Winderling / @kaHaleMaKai

11/28/2022 at 08:23PM

35
#327 - Ryuichiroh Ikeuchi / @ryuichiroh_ike

11/30/2022 at 03:27PM

35
#328 - AIUEHARA / @AIUEHARA15

12/04/2022 at 02:07PM

35
#329 - Ringel Natter / @SenorTenor

02/10/2023 at 11:15PM

35
#330 - RosaTryp / @RosaTryp

03/10/2023 at 03:19PM