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

451 active golfers, 1857 entries

Leaderboard (lowest score wins):
36
#271 - vimgolfaccfekxh / @vimgolfaccfekxh

09/28/2022 at 07:58PM

36
#272 - steve / @steve35773420

11/19/2022 at 03:09PM

37
#273 - Clmi / @c_decaf

04/08/2022 at 07:28AM

37
#274 - ccorvi / @ccorvi1

05/16/2022 at 03:29PM

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

06/22/2022 at 03:13PM

37
#276 - adrian / @adrian09610908

08/08/2022 at 04:25AM

37
#277 - Moritz Kraus / @MoritzKraus4

09/03/2022 at 06:13PM

37
#278 - Vim Golf / @Golf4Vim

10/30/2022 at 07:24PM

38
#279 - Nougatine Naja / @NougatineNaja

03/22/2022 at 12:15PM

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

04/03/2022 at 10:04AM

38
#281 - Eric Wannemacher / @ericwannemacher

04/03/2022 at 10:57PM

38
#282 - Alex / @AlexanderHeatl2

05/21/2022 at 08:47PM

38
#283 - happy cola / @ccolahappy

06/11/2022 at 07:16PM

38
#284 - ohwell / @KiranClose

07/30/2022 at 03:44PM

38
#285 - Alfio / @Alfio31105646

05/14/2023 at 01:07PM

38
#286 - Erick Gonzalez / @eygl_erick

06/09/2023 at 03:41AM

38
#287 - Peter Szerzo / @peterszerzo

07/08/2023 at 07:58AM

39
#288 - Emil / @emilklindt

04/04/2022 at 04:03PM

39
#289 - Justin Sane / @Here4Vimgolf

04/22/2022 at 02:13PM

39
#290 - Allen Li / @thenightawl

05/04/2022 at 03:54AM

39
#291 - jofene / @jofene2

05/07/2022 at 08:50AM

39
#292 - corei8 / @Corei8Github

05/14/2022 at 07:05PM

39
#293 - koppa / @4koppa

05/21/2022 at 04:08PM

39
#294 - rando bando / @randoba40946238

06/24/2022 at 01:53AM

39
#295 - 马海洋 / @LG41bT7ZvqOdFl3

02/07/2023 at 04:57AM

40
#296 - Camille 🌷 / @StupideCamille

04/08/2022 at 08:03AM

40
#297 - Chinmay Dalal / @p00fd

05/05/2022 at 08:17AM

40
#298 - T. Arch / @TArch76864215

06/09/2022 at 07:02PM

40
#299 - pady. 🇪🇺 / @hundertzwoelf_

11/12/2022 at 07:56PM

40
#300 - Alexandre Ignjatovic / @bankair

01/23/2023 at 11:30AM