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

1749 active golfers, 5079 entries

Leaderboard (lowest score wins):
11
#271 - Aleksandr Block / @AleksandrBlock

03/04/2014 at 10:33PM

11
#272 - Milind Ganjoo / @mganjoo

03/07/2014 at 03:21AM

11
#273 - Chris McKinnel / @chrismckinnel

03/07/2014 at 05:58PM

11
#274 - Konrad / @zichul

03/08/2014 at 03:03AM

11
#275 - Jared Weakly / @jaredweakly

03/08/2014 at 05:53AM

11
#276 - hk3380 / @hk3380

03/08/2014 at 01:07PM

11
#277 - sprmgik / @sprmgik

03/14/2014 at 03:48AM

11
#278 - Joonas Pihlajamaa / @jokkebk

03/19/2014 at 11:35AM

11
#279 - Matt Stinson / @MrMatt2532

03/19/2014 at 07:28PM

11
#280 - Luke Ellis / @slav0x

03/21/2014 at 10:17AM

11
#281 - Isaac / @elemental_1_1

03/25/2014 at 02:28AM

11
#282 - Jeff / @just_geophree

03/30/2014 at 01:57AM

11
#283 - Nabi Studios / @Toribash

03/30/2014 at 06:49AM

11
#284 - Aidan Brumsickle / @aidanbrumsickle

04/02/2014 at 01:11PM

11
#285 - gcavn / @gcavn

04/10/2014 at 10:08AM

11
#286 - ZorgroZ / @ZorgroZ

04/10/2014 at 11:40PM

11
#287 - Akshay Hegde / @ajh_17

04/14/2014 at 12:09AM

11
#288 - Aleksander Gajewski / @adgajewski

04/20/2014 at 02:45PM

11
#289 - Peeby Thirtyone / @peeby31

05/03/2014 at 10:46PM

11
#290 - Tom Gilligan / @sargegood

05/05/2014 at 09:39PM

11
#291 - Martin Delille / @martinodelilo

05/09/2014 at 09:05PM

11
#292 - zmo / @guyzmo

05/10/2014 at 03:20PM

11
#293 - kiho choi / @ArtStandAlone

05/15/2014 at 09:17AM

11
#294 - Henry Blevins / @HenryBlevins

05/18/2014 at 04:27PM

11
#295 - Alex / @ven_y_toma

05/18/2014 at 10:30PM

11
#296 - Hogan Seah / @geechrist

05/20/2014 at 08:54PM

11
#297 - Benoit d'Oncieu / @bdoncieu

06/04/2014 at 01:49PM

11
#298 - Steffen Siering / @ursobln

06/04/2014 at 09:37PM

11
#299 - Jonas Arnold Clasen / @jonasclasen

06/09/2014 at 06:01PM

11
#300 - Robert Bruce / @therealrobru

06/10/2014 at 11:40PM