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

1519 active golfers, 4345 entries

Leaderboard (lowest score wins):
13
#961 - Foo Bar / @FooWatson

12/11/2013 at 09:08PM

13
#962 - John Gray Cole / @johngraycole

12/14/2013 at 07:01PM

13
#963 - Matt Parnell / @parnmattdev

01/02/2014 at 10:20PM

13
#964 - Davey Struijk / @daveystruijk

01/04/2014 at 01:43PM

13
#965 - Greg Jebb / @jebbster

01/06/2014 at 07:27AM

13
#966 - Hoxie Ackerman / @hoxie

01/08/2014 at 04:24PM

13
#967 - Jeff Rimko / @jeffrimko

01/11/2014 at 04:29AM

13
#968 - Dmitry Astapenko / @dmitree

01/11/2014 at 03:10PM

13
#969 - Andreas Källberg / @Anka213

01/17/2014 at 12:11AM

13
#970 - Kim Laï Trinh / @KimLaTrinh

01/23/2014 at 03:35PM

13
#971 - Tomek Solak / @tomeksolak

01/28/2014 at 04:02PM

13
#972 - Diego Ardila / @diegoard

01/28/2014 at 09:24PM

13
#973 - Rick O'Toole / @rickotoole

01/29/2014 at 01:50AM

13
#974 - ひげまにや / @higemaniya

01/29/2014 at 03:33AM

13
#975 - n0nick / @n0nick

01/29/2014 at 08:54AM

13
#976 - Alex Kunin / @alexkunin

02/02/2014 at 05:10PM

13
#977 - John Phelan / @jackphel

02/03/2014 at 07:19PM

13
#978 - John Hilts / @johnhilts

02/04/2014 at 08:00AM

13
#979 - Tyler van Hensbergen / @tvanhens

02/14/2014 at 09:26PM

13
#980 - Chi Bong Ho / @chibongho

02/16/2014 at 02:09AM

13
#981 - Dayne Jones / @daynejones

02/20/2014 at 09:26PM

13
#982 - Tim Green / @iamtimgreen

03/05/2014 at 02:32AM

13
#983 - Jack Jacquemmoz / @MozJack

03/05/2014 at 10:02AM

13
#984 - Franck / @_frp

03/06/2014 at 10:44AM

13
#985 - Rolinh / @Rolinh42

03/13/2014 at 11:36AM

13
#986 - Brian Olpin / @bolpin

03/22/2014 at 10:20PM

13
#987 - Sheriuki / @sheriuki

03/28/2014 at 01:53PM

13
#988 - Felipe Jaramillo F / @mrfelipe

04/01/2014 at 05:45PM

13
#989 - Lance Levine / @LanceSMLevine

04/02/2014 at 04:55AM

13
#990 - David Barker / @dashleybarker

04/03/2014 at 03:16AM