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

1548 active golfers, 4443 entries

Leaderboard (lowest score wins):
16
#1381 - Cody Veal / @cjhveal

02/01/2012 at 07:47AM

16
#1382 - はなたん / @hntn

02/04/2012 at 12:41AM

16
#1383 - Martin Desrosiers / @mdesrosiers

02/21/2012 at 06:42AM

16
#1384 - Stormy Shippy / @Stormy

02/26/2012 at 11:49PM

16
#1385 - Lou Kosak / @hoverkraft

04/20/2012 at 01:05AM

16
#1386 - Bernhard Urban / @lewurm

06/24/2012 at 07:28PM

16
#1387 - Howard / @h0w412d

07/16/2012 at 02:55AM

16
#1388 - Ben Alpert / @soprano

07/17/2012 at 09:14AM

16
#1389 - Federico Bond / @federicobond

09/23/2012 at 04:53AM

16
#1390 - Maksim S. / @waynesayonara

07/28/2013 at 04:02PM

16
#1391 - Jon Lee / @joncslee

08/02/2013 at 06:32PM

16
#1392 - James Zaghini / @jameszaghini

08/08/2013 at 11:42AM

16
#1393 - paul / @showmeroot

08/17/2013 at 11:03PM

16
#1394 - Yu / @Yuyah1

09/13/2013 at 02:43AM

16
#1395 - Frettchen / @DayOfFrettchen

09/21/2013 at 03:08PM

16
#1396 - codegourmet / @codegourmet

10/02/2013 at 07:23AM

16
#1397 - Ian Oxley / @ianoxley

10/24/2013 at 01:49PM

16
#1398 - wilddog64 / @chengkai318

12/17/2013 at 05:51PM

16
#1399 - pikaren / @REALpikaren

12/21/2013 at 08:28AM

16
#1400 - Brian Peiris / @brianpeiris

12/28/2013 at 05:05AM

16
#1401 - Mohit Sharma / @m0hitsharma

12/30/2013 at 02:51AM

16
#1402 - Zhiyuan Shi / @zhiyuan_shi

01/01/2014 at 12:32PM

16
#1403 - Quota / @Quotad

01/10/2014 at 02:27PM

16
#1404 - ren / @wxoc

02/19/2014 at 10:53AM

16
#1405 - Bart / @oneofmanybarts

03/11/2014 at 03:09PM

16
#1406 - Aurélien Vallée / @aurelienvallee

04/29/2014 at 12:16PM

16
#1407 - Jorge Márquez Ortega / @Predicador001

05/21/2014 at 06:17PM

16
#1408 - Hendrik Lammers / @hendriklammers

06/14/2014 at 05:15PM

16
#1409 - Herr Oppermann / @HerrOppermann

06/15/2014 at 02:22PM

16
#1410 - liz monfett / @lizmonfett

07/05/2014 at 04:38AM