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

1433 active golfers, 4095 entries

Leaderboard (lowest score wins):
3
#1 - Alexander Shpilevsky / @AlexShpil

11/08/2018 at 07:16PM

11
#2 - captain_morgan / @captain_morgan

01/06/2012 at 04:38PM

11
#3 - Pavlo Klets / @p01nt

01/06/2012 at 04:42PM

11
#4 - Tim Chase / @gumnos

01/06/2012 at 04:50PM

11
#5 - h_east (トロッコ6個) / @h_east

01/06/2012 at 04:54PM

11
#6 - Mihai Crăiță / @mihai_craita

01/06/2012 at 07:03PM

11
#7 - Maciej Suchecki / @mcSuchecki

01/06/2012 at 08:17PM

11
#8 - Burkhard Zimmermann / @BurkZimm

01/06/2012 at 10:24PM

11
#9 - Justin Love / @wondible

01/07/2012 at 01:00AM

11
#10 - Ernestas / @ernestas

01/07/2012 at 08:09AM

11
#11 - Pei-Lun Lee / @ypcatw

01/08/2012 at 05:34AM

11
#12 - Abdel Said / @abdelsaid

01/09/2012 at 12:53AM

11
#13 - twobit / @_2bt

01/09/2012 at 01:05AM

11
#14 - Vasil Sakarov / @vsakarov

01/10/2012 at 10:55PM

11
#15 - Toshiyuki Nakamura / @yukidarake

01/13/2012 at 05:42AM

11
#16 - Martin Aumueller / @aumuell

01/15/2012 at 10:08PM

11
#17 - Dmitry Teslenko / @krab_mozga

01/16/2012 at 11:59AM

11
#18 - D. Marano / @pleiadeez

01/19/2012 at 04:48AM

11
#19 - Arton0306 / @Arton0306

01/19/2012 at 05:18AM

11
#20 - Song Zheng / @songz

01/19/2012 at 06:36AM

11
#21 - Wataru Fukunaga / @wataru420

01/19/2012 at 04:54PM

11
#22 - Mikael Amborn / @mikaelamborn

01/20/2012 at 08:11AM

11
#23 - Omer Lachish / @rauchy

01/22/2012 at 06:29AM

11
#24 - space for rent / @raf_whispering

01/22/2012 at 07:09PM

11
#25 - J. Cordasco / @jcordasc

01/23/2012 at 02:00AM

11
#26 - zDlZPSx zDlZPSx / @zDlZPSx

01/26/2012 at 11:42PM

11
#27 - tomox1001 / @tomox1001

01/27/2012 at 04:17AM

11
#28 - kcliu / @kcliutw

01/27/2012 at 07:22AM

11
#29 - JR Boyens / @jboyens

01/27/2012 at 10:37PM

11
#30 - Jaime A. Sánchez / @jashbeta

01/29/2012 at 05:32AM