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 4f0720c8f037090001000007

switch variable

how fast can you switch two variable ?

Start file
int barins, foovariable = 1; 
End file
int foovariable, barins = 1; 

View Diff

1c1
< int barins, foovariable = 1; 
---
> int foovariable, barins = 1; 

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 1508 remaining solutions by signing in and submitting your own entry
#1509 Pete Pete / @iPetePete - Score: 633 - 02/14/14 @ 18:32
:s/int (.<BS>a<BS>[a-z]+),<Left><Left><Left><Left><Left><Left><Left><Left><Left><Right><Right><Right><Right><Right><Right><Right><Right><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>(int )([^,]+)<Right> (/w<BS><BS>w<BS>\w)(.*)/$1$3, $<BS>$2$5<BS>4/<CR>i:<BS><Esc>:s/int (\w)/hi/g<CR>:s.<BS>/iu<BS>nt (\w+), (w<BS>\w+)/int $2, $1/<CR>:s/int ([a-z]+), ([a_<BS>-z])<BS>+)/int $2, #<BS>$1/<CR>:s/int/<BS> ([a-z]+)<CR><Up>:<Up>/ int<BS><BS><BS><BS>int fuck/<CR>:s/int <BS>\ barin<BS><BS><BS><BS><BS>barin<BS><BS><BS><BS><BS>([a-z]+)/<BS>, <BS>\ ([a-z]+)/int $2<BS><BS><BS>\ 2<BS>$2, $2<BS><BS><BS><BS>m<BS>,\ $1/g<CR>/s<BS><BS>:#<BS>%s/barins/foovariable/g<CR>:q<BS>%/s<BS><BS>s/([a-z]+)<BS><Left><Left><Left><Left><Left><Left><BS><Right><Right><Right><Right><Right><Right>/dude/g<CR>::<BS>u<CR>:s/int \(a<BS>[a-z]+)<BS>\), \([a-z]+\(<BS>)/int $2, $1/<CR>:<Up><C-A>%<BS><BS><Left><Left><Left><Left><Left><Left>^<Left><Right><BS><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>%<CR>:<Up><Down>%s/int (<BS>\9a<BS><BS>([a-z]_<BS><BS>]\<BS>\+\)/int $1-fart/<CR>u<Up>:<Up><Left><Right><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>, \(<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>barins)<BS>\), (<BS>\(fa<BS>oovariable\)/int \2, $<BS>\1<CR>:wq<CR>

0 comments


Created by: @lukastsai

1509 active golfers, 4317 entries

Leaderboard (lowest score wins):
11
#481 - Terry Ding / @TerryDing77

08/24/2017 at 11:58AM

11
#482 - Darren Weston / @dazWestonUK

08/30/2017 at 03:55PM

11
#483 - Дима / @dimkino

09/07/2017 at 06:44PM

11
#484 - Luke Bryant / @LukeBryant55

10/01/2017 at 10:54PM

11
#485 - Charlie OConor / @charlieoconor

10/02/2017 at 07:36PM

11
#486 - mkl / @Hnr1zklc

10/24/2017 at 03:51PM

11
#487 - Florian Kluck / @KluckF

10/30/2017 at 07:03PM

11
#488 - Turkey Man / @lvturkeyman

11/08/2017 at 03:34PM

11
#489 - Sage san / @sagesancast

12/18/2017 at 05:22PM

11
#490 - BarbaJol / @drpproteus

12/31/2017 at 10:20AM

11
#491 - Edward / @GLineEdward

01/03/2018 at 11:41AM

11
#492 - c0llision / @sh3llcode

01/26/2018 at 08:12PM

11
#493 - ParasamGateZero / @ParasamGateZero

01/28/2018 at 02:18AM

11
#494 - bocadillodeatun / @bocadillodeatun

01/28/2018 at 02:14PM

11
#495 - John C Shea / @MHSSachems

02/08/2018 at 01:09PM

11
#496 - Veljko Dimic / @v2dimic

02/12/2018 at 02:13PM

11
#497 - Guirec CORBEL / @GuirecCorbel

03/08/2018 at 12:43AM

11
#498 - GreenPinguin / @GreenPinguin2

03/09/2018 at 05:15PM

11
#499 - Kaydo Alders / @Yousousen

03/13/2018 at 11:04AM

11
#500 - vimthrowaway / @vimgolf_throw

03/31/2018 at 09:08AM

11
#501 - Vim Golf / @VimgolfVim

04/01/2018 at 05:08AM

11
#502 - Pablo / @suspekt007

04/10/2018 at 07:52PM

11
#503 - Zach Johnson / @zachjohnsondev

05/08/2018 at 12:16AM

11
#504 - d8d90d / @d8d90d

05/08/2018 at 10:29PM

11
#505 - Daniël De Koker / @daniel_koker

06/17/2018 at 09:47AM

11
#506 - Justin Hoyt / @JustinHoyt24

06/24/2018 at 01:48AM

11
#507 - Henry Woolenthorpe / @woolenthorpe

07/05/2018 at 07:44AM

11
#508 - Andrew Peterson / @FungalRaincloud

07/30/2018 at 01:52AM

11
#509 - Francesco Sacchi / @depsir

08/01/2018 at 11:18AM

11
#510 - Samuel Hsiang / @alwayswimmin

08/05/2018 at 01:11AM