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 1528 remaining solutions by signing in and submitting your own entry
#1529 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

1529 active golfers, 4382 entries

Leaderboard (lowest score wins):
18
#1441 - Christian Genco / @cgenco

02/12/2014 at 03:41AM

18
#1442 - Josh Szepietowski / @joshSzep

11/04/2014 at 11:24PM

18
#1443 - Andrew Michaud / @andrewjmichaud

09/04/2015 at 01:14AM

18
#1444 - Theodore DeRego / @tedsta0

12/08/2015 at 03:12AM

18
#1445 - Scott Traver / @ScottTraver

02/12/2016 at 10:42PM

18
#1446 - Jared Fowler / @jared_fowler

07/29/2017 at 01:10AM

18
#1447 - artisan bed maker / @ebencooke

01/15/2018 at 03:13PM

18
#1448 - Daniel de Vries / @devries_d

02/13/2018 at 12:52AM

18
#1449 - Akilan Anbalagan / @akilananb

03/27/2018 at 01:06PM

18
#1450 - egormeister / @egormeister1

10/24/2018 at 03:15PM

18
#1451 - Graham Singer / @grahamsinger

01/05/2019 at 05:36AM

19
#1452 - Clinton シ / @iblamefish

01/06/2012 at 05:04PM

19
#1453 - James Freed / @JamesTFreed

02/02/2012 at 10:44PM

19
#1454 - Markus Neusinger / @Tira0

02/23/2012 at 08:14AM

19
#1455 - Brandon Farmer / @bthesorceror

06/18/2012 at 08:17PM

19
#1456 - James Thomson / @jomsie

01/09/2013 at 08:45PM

19
#1457 - Coder 2.0 / @coder20

06/24/2013 at 02:10AM

19
#1458 - Andrew Dennis / @ALzonedOut

07/18/2013 at 12:12AM

19
#1459 - dickbutt / @ryan_haynes

10/24/2013 at 10:06PM

19
#1460 - tomjackbear / @tomjackbear

01/03/2014 at 04:57PM

19
#1461 - Shashank Srivastav / @fnatic_shank

02/01/2014 at 11:21AM

19
#1462 - Alex Bundy / @plntmusic

06/04/2014 at 03:41AM

19
#1463 - tapio / @gncnaxb

02/28/2018 at 08:12PM

20
#1464 - Alfredo Di Napoli / @alfredodinapoli

04/28/2012 at 05:03PM

20
#1465 - Alex Bartol / @alexbartol

05/06/2015 at 05:36AM

20
#1466 - Random Name / @spamplzignore

10/28/2017 at 08:11PM

20
#1467 - Thib / @thibthib_n

08/24/2018 at 05:32PM

20
#1468 - Jurica / @Jurica34581259

11/16/2018 at 11:15AM

21
#1469 - jared / @shmup

02/15/2012 at 07:02AM

21
#1470 - Dan Masquelier / @danmasq

02/16/2012 at 06:00PM