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

1467 active golfers, 4212 entries

Leaderboard (lowest score wins):
11
#391 - Roberto Carraretto / @robcarraretto

01/23/2016 at 12:13AM

11
#392 - Aleksey Zhidkov / @AlexeyZhidkov

01/27/2016 at 10:17AM

11
#393 - Kevin Grandemange / @tic_le_polard

01/30/2016 at 02:03PM

11
#394 - Ian Trophy / @prfrgg

01/31/2016 at 06:08PM

11
#395 - Austin Wood / @indiesquidge

02/02/2016 at 05:48PM

11
#396 - James Burns / @James_Ian_Burns

02/11/2016 at 01:39PM

11
#397 - Michael Buckley / @apolatg

02/13/2016 at 08:00PM

11
#398 - Thijs van den Anker / @thijsvdanker

02/16/2016 at 07:11PM

11
#399 - Pratap Koritala / @pratap_koritala

02/19/2016 at 11:45AM

11
#400 - Durga Swaroop Perla / @durgaswaroop

02/21/2016 at 07:18AM

11
#401 - ben kavanagh / @bkava

02/22/2016 at 11:26PM

11
#402 - John Smith / @literacyisgood

02/24/2016 at 10:54PM

11
#403 - Jaron Hamlik / @jdhamlik

02/27/2016 at 04:04AM

11
#404 - Niels Madan / @nielsmadan

03/03/2016 at 12:35PM

11
#405 - hardaudit / @hardaudit

03/04/2016 at 10:36AM

11
#406 - Yahyalexandre33 / @yahyalexandre33

03/15/2016 at 08:05AM

11
#407 - M S / @b1790037

03/15/2016 at 06:22PM

11
#408 - Dmitry Motylev / @d12v

03/19/2016 at 06:14PM

11
#409 - Janko Jerinic / @JankoJerinic

03/26/2016 at 08:36AM

11
#410 - Dinesh Bhosale / @MrDineshBhosale

04/01/2016 at 09:26AM

11
#411 - Saki Gw / @Sakigw

04/03/2016 at 05:10PM

11
#412 - エクシル / @sicoh395

04/07/2016 at 01:47PM

11
#413 - harpocrates744 / @harpocrates744

04/12/2016 at 12:12AM

11
#414 - Johnny Zhou / @JohnnyZhou01

04/24/2016 at 01:33PM

11
#415 - John Goes / @johnwgoes

05/07/2016 at 09:25PM

11
#416 - Joel Gärtner / @Jeerok

05/25/2016 at 07:44PM

11
#417 - Edan Sneh / @edan_sneh

05/26/2016 at 11:25PM

11
#418 - niels aamloos / @AamloosNiels

05/28/2016 at 03:48PM

11
#419 - Tom / @CronutFacts

06/05/2016 at 02:58AM

11
#420 - Elliott Beach / @718282Beach

06/06/2016 at 06:12AM