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

491 active golfers, 2048 entries

Leaderboard (lowest score wins):
37
#301 - ccorvi / @ccorvi1

05/16/2022 at 03:29PM

37
#302 - kovapi3088@serosin.com / @test39654481

06/22/2022 at 03:13PM

37
#303 - adrian / @adrian09610908

08/08/2022 at 04:25AM

37
#304 - Moritz Kraus / @MoritzKraus4

09/03/2022 at 06:13PM

37
#305 - Vim Golf / @Golf4Vim

10/30/2022 at 07:24PM

37
#306 - mveraart / @mveraart

11/17/2023 at 07:56PM

38
#307 - Nougatine Naja / @NougatineNaja

03/22/2022 at 12:15PM

38
#308 - Jason Kuan | jasonkuan.eth / @Jason9075Kuan

04/03/2022 at 10:04AM

38
#309 - Eric Wannemacher / @ericwannemacher

04/03/2022 at 10:57PM

38
#310 - Alex / @AlexanderHeatl2

05/21/2022 at 08:47PM

38
#311 - happy cola / @ccolahappy

06/11/2022 at 07:16PM

38
#312 - ohwell / @KiranClose

07/30/2022 at 03:44PM

38
#313 - Alfio / @Alfio31105646

05/14/2023 at 01:07PM

38
#314 - Erick Gonzalez / @eygl_erick

06/09/2023 at 03:41AM

38
#315 - Peter Szerzo / @peterszerzo

07/08/2023 at 07:58AM

39
#316 - Emil / @emilklindt

04/04/2022 at 04:03PM

39
#317 - Justin Sane / @Here4Vimgolf

04/22/2022 at 02:13PM

39
#318 - Allen Li / @thenightawl

05/04/2022 at 03:54AM

39
#319 - jofene / @jofene2

05/07/2022 at 08:50AM

39
#320 - corei8 / @Corei8Github

05/14/2022 at 07:05PM

39
#321 - koppa / @4koppa

05/21/2022 at 04:08PM

39
#322 - rando bando / @randoba40946238

06/24/2022 at 01:53AM

39
#323 - 马海洋 / @LG41bT7ZvqOdFl3

02/07/2023 at 04:57AM

39
#324 - rayx / @ray-x

12/02/2023 at 07:36AM

40
#325 - Camille 🌷 / @StupideCamille

04/08/2022 at 08:03AM

40
#326 - Chinmay Dalal / @p00fd

05/05/2022 at 08:17AM

40
#327 - T. Arch / @TArch76864215

06/09/2022 at 07:02PM

40
#328 - pady. 🇪🇺 / @hundertzwoelf_

11/12/2022 at 07:56PM

40
#329 - Alexandre Ignjatovic / @bankair

01/23/2023 at 11:30AM

40
#330 - Sylvain Dangin / @Sylvaner03

02/25/2023 at 08:12PM