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

1490 active golfers, 4286 entries

Leaderboard (lowest score wins):
11
#331 - Johannes H. / @neVexa

09/22/2014 at 08:59PM

11
#332 - PackMan97 / @PackMan97

09/24/2014 at 04:14PM

11
#333 - Nicholas Lee-Hone / @NicholasLeeHone

10/16/2014 at 06:48PM

11
#334 - Jakob / @jajob

10/18/2014 at 05:33AM

11
#335 - Hrvoje Kopinc / @Hrwaaa

11/16/2014 at 04:13PM

11
#336 - Haitao Li / @lihaitao

11/17/2014 at 03:04PM

11
#337 - tacke / @tacke_jp

11/21/2014 at 12:51AM

11
#338 - Yuriy / @skriyka

12/05/2014 at 11:03PM

11
#339 - Ivan Brennan / @ivanbrennan

12/06/2014 at 06:36AM

11
#340 - Roberto Alegro / @robertoaall

12/08/2014 at 06:34PM

11
#341 - david hu / @chin33z

12/17/2014 at 02:42PM

11
#342 - Andrew Leung / @aleungpivotal

12/22/2014 at 08:49PM

11
#343 - Maximiliano Padulo / @mpadulo

01/08/2015 at 09:01AM

11
#344 - kimber gonzalez / @kimberlycreates

01/13/2015 at 03:53PM

11
#345 - mark0829 / @mark0829

01/31/2015 at 05:02AM

11
#346 - Michael Giuffrida / @mgiuffrida

02/24/2015 at 08:40AM

11
#347 - Dmitry / @Kent3200

03/03/2015 at 02:59PM

11
#348 - Matthew Pryor / @HodgekaGames

03/03/2015 at 09:48PM

11
#349 - DrHobo / @_DrHobo_

03/15/2015 at 03:29AM

11
#350 - Bradley Garagan / @bradgaragan

03/18/2015 at 07:47PM

11
#351 - Alexander Kazakov / @volandkot

03/31/2015 at 07:47AM

11
#352 - Charles A. Bouffard / @the_cabouffard

04/05/2015 at 06:43PM

11
#353 - E Both / @enboth

04/08/2015 at 04:36PM

11
#354 - pftb12345 / @pftb12345

04/10/2015 at 02:23PM

11
#355 - Server Zero / @assaflavie

04/19/2015 at 07:58PM

11
#356 - Raj / @brshenoy

04/20/2015 at 03:01PM

11
#357 - Evan Coleman / @edc1591

04/20/2015 at 03:09PM

11
#358 - Котов Роман / @Oxaide16

05/23/2015 at 06:29AM

11
#359 - Stefan Knudsen / @knud32

05/25/2015 at 05:00AM

11
#360 - Marc Coquand / @MarcCoquand

05/30/2015 at 04:20PM