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
#31 - Butter / @butterlab

01/30/2012 at 02:38PM

11
#32 - Thijs Brobbel / @tiesmaster

01/30/2012 at 02:42PM

11
#33 - Spencer Liang / @liangspencer

01/30/2012 at 02:53PM

11
#34 - Alexander D'hoore / @AlexDhoore

01/30/2012 at 03:31PM

11
#35 - themolok / @themolok

01/30/2012 at 11:02PM

11
#36 - Tesnorth / @Tesnorth

01/30/2012 at 11:21PM

11
#37 - veki / @vx_ras

01/31/2012 at 11:50AM

11
#38 - Neil Edwards / @neiled

01/31/2012 at 12:56PM

11
#39 - Chris Geihsler / @seejee

01/31/2012 at 10:53PM

11
#40 - Lin Yangyang / @canoelyy

02/01/2012 at 03:25AM

11
#41 - Dragan Cvetinovic / @kawkafi

02/01/2012 at 08:47PM

11
#42 - Matthew / @so3arbelnox

02/02/2012 at 02:35AM

11
#43 - Clark Fischer / @clark_fischer

02/02/2012 at 12:13PM

11
#44 - Jiří Chára / @JiriChara

02/02/2012 at 10:35PM

11
#45 - Jan Sedivy / @jan_sedivy

02/04/2012 at 08:05PM

11
#46 - John / @OneOhOneOhOneOh

02/05/2012 at 12:29AM

11
#47 - Renat Aksitov / @Korvin79

02/05/2012 at 02:08AM

11
#48 - Víctor Pimentel / @VictorPimentel

02/05/2012 at 02:37AM

11
#49 - Dan Hart / @DHJHart

02/07/2012 at 05:58PM

11
#50 - caio / @caioariede

02/08/2012 at 02:34AM

11
#51 - Leandro N. Camargo / @leandroico

02/08/2012 at 02:25PM

11
#52 - Kieran / @kgleeson

02/08/2012 at 10:20PM

11
#53 - Solon / @solon

02/08/2012 at 10:47PM

11
#54 - Scott Leishman / @scttl

02/10/2012 at 07:07AM

11
#55 - sidyll / @sidyll

02/10/2012 at 05:34PM

11
#56 - Kurt Gaastra / @KGaastra

02/10/2012 at 11:01PM

11
#57 - Darren Firth / @DarrenSFirth

02/11/2012 at 02:42AM

11
#58 - Adrian Roston / @akroston

02/11/2012 at 06:13PM

11
#59 - Dave Harrington / @ozzy_dave

02/11/2012 at 08:00PM

11
#60 - Jason Parrott / @jparrott

02/11/2012 at 09:06PM