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
#271 - Martin Chabot / @martinosis

03/02/2014 at 05:39PM

11
#272 - Roman Reithmayer / @sharenz0

03/03/2014 at 07:52AM

11
#273 - Aleksandr Block / @AleksandrBlock

03/04/2014 at 10:33PM

11
#274 - Milind Ganjoo / @mganjoo

03/07/2014 at 03:21AM

11
#275 - Chris McKinnel / @chrismckinnel

03/07/2014 at 05:58PM

11
#276 - Konrad / @zichul

03/08/2014 at 03:03AM

11
#277 - Jared Weakly / @jaredweakly

03/08/2014 at 05:53AM

11
#278 - hk3380 / @hk3380

03/08/2014 at 01:07PM

11
#279 - sprmgik / @sprmgik

03/14/2014 at 03:48AM

11
#280 - Joonas Pihlajamaa / @jokkebk

03/19/2014 at 11:35AM

11
#281 - Matt Stinson / @MrMatt2532

03/19/2014 at 07:28PM

11
#282 - Luke Ellis / @slav0x

03/21/2014 at 10:17AM

11
#283 - Isaac / @elemental_1_1

03/25/2014 at 02:28AM

11
#284 - Jeff / @just_geophree

03/30/2014 at 01:57AM

11
#285 - Nabi Studios / @Toribash

03/30/2014 at 06:49AM

11
#286 - Aidan Brumsickle / @aidanbrumsickle

04/02/2014 at 01:11PM

11
#287 - gcavn / @gcavn

04/10/2014 at 10:08AM

11
#288 - ZorgroZ / @ZorgroZ

04/10/2014 at 11:40PM

11
#289 - Akshay Hegde / @ajh_17

04/14/2014 at 12:09AM

11
#290 - Aleksander Gajewski / @adgajewski

04/20/2014 at 02:45PM

11
#291 - Peeby Thirtyone / @peeby31

05/03/2014 at 10:46PM

11
#292 - Tom Gilligan / @sargegood

05/05/2014 at 09:39PM

11
#293 - Martin Delille / @martinodelilo

05/09/2014 at 09:05PM

11
#294 - zmo / @guyzmo

05/10/2014 at 03:20PM

11
#295 - kiho choi / @ArtStandAlone

05/15/2014 at 09:17AM

11
#296 - Henry Blevins / @HenryBlevins

05/18/2014 at 04:27PM

11
#297 - Alex / @ven_y_toma

05/18/2014 at 10:30PM

11
#298 - Hogan Seah / @geechrist

05/20/2014 at 08:54PM

11
#299 - Benoit d'Oncieu / @bdoncieu

06/04/2014 at 01:49PM

11
#300 - Steffen Siering / @ursobln

06/04/2014 at 09:37PM