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
#181 - Charlene Tshos / @charlymul

08/22/2013 at 04:33PM

11
#182 - Rémi Jézéquel / @Remjez

08/23/2013 at 02:12PM

11
#183 - Barry Nichols / @Barry_Nichols

08/26/2013 at 06:11AM

11
#184 - Nick Harding / @nick_harding

08/27/2013 at 08:48PM

11
#185 - Dan / @dan_winkler

08/28/2013 at 03:33AM

11
#186 - Bradley Tse / @bradleytse

08/30/2013 at 01:39AM

11
#187 - Arthur叔 / @Arthurljg

08/30/2013 at 05:47PM

11
#188 - Lars Storjord / @lstor

08/31/2013 at 09:04PM

11
#189 - Arturo Escaip / @arturoescaip

09/01/2013 at 02:25AM

11
#190 - Amar Battulga / @amar_battulga

09/06/2013 at 07:36AM

11
#191 - isayoldchap / @isayoldchap

09/07/2013 at 07:08PM

11
#192 - Stephen Drodge / @sjdrodge

09/12/2013 at 02:41AM

11
#193 - Alykhan Kanji / @alykhank

09/13/2013 at 10:11PM

11
#194 - Matt Green / @emgeeeeee

09/17/2013 at 03:07AM

11
#195 - Rafa Garcia / @fafa

09/19/2013 at 09:07AM

11
#196 - Dary Merckens / @merckens

09/23/2013 at 10:28PM

11
#197 - Throw Away / @throwaway111111

10/02/2013 at 11:52PM

11
#198 - aRkadeFR / @aRkadeFR

10/03/2013 at 06:56AM

11
#199 - Devin Gray / @devinagray

10/03/2013 at 08:27PM

11
#200 - Grégoire Delattre / @gregdel

10/04/2013 at 06:41PM

11
#201 - NuM / @NuM314

10/05/2013 at 09:03PM

11
#202 - StarkHalo / @hellektor

10/07/2013 at 02:36AM

11
#203 - buz / @buzbone

10/08/2013 at 02:28PM

11
#204 - Travis Millott / @ritherz

10/10/2013 at 09:54PM

11
#205 - yoohey / @yoohey_m

10/22/2013 at 11:54AM

11
#206 - Casey Dwyer / @caseydwyer

10/23/2013 at 07:44AM

11
#207 - Hoz / @hzopak

10/28/2013 at 03:17PM

11
#208 - Tyler HT Cipriani / @tylercipriani

10/28/2013 at 10:40PM

11
#209 - c / @mmo_chess

11/04/2013 at 10:15AM

11
#210 - sockdude1 / @sockdude1

11/05/2013 at 05:20AM