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

619 active golfers, 2663 entries

Leaderboard (lowest score wins):
33
#301 - Megan Niu / @MeganNiu

06/25/2022 at 04:40PM

33
#302 - Robin / @donpavlas

07/09/2022 at 04:38PM

33
#303 - Aarya / @aaryabhatia6

07/15/2022 at 03:42AM

33
#304 - Sarang Khim / @sarang_khim

07/27/2022 at 08:53AM

33
#305 - Brandon / @Brandon10678836

10/16/2022 at 02:26PM

33
#306 - phazy / @phazy_x86

01/10/2023 at 12:43PM

33
#307 - Mohamad Abou Harb / @TwoShock

07/24/2023 at 12:01PM

33
#308 - João Britto / @joaobrittoneto

01/04/2024 at 06:23PM

33
#309 - Giacomo Sansone / @pcineverdies

07/02/2024 at 06:46PM

33
#310 - Jin Hao / @hongjinhao

08/11/2024 at 02:36AM

34
#311 - Максим Инп / @InpMaksim

05/07/2022 at 02:40PM

34
#312 - Golfer / @Golfer56598542

06/24/2022 at 11:17AM

34
#313 - Tanguy Defer / @TanguyDefer

07/06/2022 at 03:34PM

34
#314 - Kim Hunter / @bigkm

08/02/2022 at 04:15AM

34
#315 - Александр Черенков / @AleksandrCeren3

08/04/2022 at 03:15PM

34
#316 - Akshay Barpute / @akshaybarpute

09/26/2022 at 01:40AM

34
#317 - Tunian Grey / @salmonianpink

02/26/2023 at 02:02PM

34
#318 - hex / @hexneth

02/26/2023 at 11:35PM

34
#319 - Fabio Ortega / @_Ortega

04/05/2023 at 06:27AM

34
#320 - Derek Schrock / @derekschrock

04/11/2023 at 10:54PM

34
#321 - wemgulf / @wemgulfer

11/02/2023 at 02:16PM

34
#322 - George Angelopoulos / @gangelop

02/17/2024 at 06:35AM

34
#323 - Panda-Ghost / @Panda-Ghost

02/23/2024 at 07:17AM

34
#324 - Rodney Visser / @_Radnus

04/05/2024 at 02:58PM

34
#325 - Johannes / @Xydez

07/10/2024 at 09:14PM

34
#326 - Henry Liu / @henryliu5

09/01/2024 at 05:56PM

35
#327 - Mark Blakeney / @bulletmark

03/18/2022 at 01:35AM

35
#328 - Alan. / @yisusalan

03/21/2022 at 04:41AM

35
#329 - pusha t daily / @rudellius

04/08/2022 at 09:02PM

35
#330 - Muziek voor Meloenen / @VoorMeloenen

04/13/2022 at 02:51PM