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
#151 - Bogdan Gusiev / @bgusiev

06/28/2013 at 08:29AM

11
#152 - 東 / @lldong

06/28/2013 at 09:35AM

11
#153 - wes / @_weslly

06/30/2013 at 08:38PM

11
#154 - For the Golf of Vim / @OfVim

07/02/2013 at 12:11AM

11
#155 - Steve Tjoa / @stevetjoa

07/03/2013 at 06:27PM

11
#156 - tomazy / @tomazy

07/07/2013 at 02:07PM

11
#157 - Huu Nguyen / @huudev

07/09/2013 at 03:08PM

11
#158 - arminas / @arminas

07/10/2013 at 09:50AM

11
#159 - Bradd Szonye / @bszonye

07/10/2013 at 11:46PM

11
#160 - Aaron Bieber / @aaronbieber

07/14/2013 at 10:48PM

11
#161 - cook / @mattcook08

07/15/2013 at 06:56PM

11
#162 - Shane Delmore / @ShaneDelmore

07/19/2013 at 03:29AM

11
#163 - MP / @Enemy_m

07/20/2013 at 08:02AM

11
#164 - Jeroen van der Neut / @jvdneut

07/20/2013 at 01:14PM

11
#165 - ———đίxίє—flαтlίиє——— / @_dixie_flatline

07/20/2013 at 05:42PM

11
#166 - Tullio Facchinetti / @toolleeo

07/23/2013 at 12:35PM

11
#167 - Tim Conner / @TimConner65

07/23/2013 at 08:07PM

11
#168 - William / @wlmeng11

07/28/2013 at 05:37AM

11
#169 - Ingo / @ist3fani

07/28/2013 at 11:53AM

11
#170 - Kevin McGladdery / @run_kmc

07/31/2013 at 05:09AM

11
#171 - Felix Stridsberg / @FelixStridsberg

08/03/2013 at 02:11PM

11
#172 - Pasha Muravyev / @pashamur

08/04/2013 at 06:29PM

11
#173 - Steven Riehl / @stevenriehl

08/05/2013 at 08:49PM

11
#174 - Chris Brown / @engineercyb

08/06/2013 at 10:41PM

11
#175 - _ky_ / @ultimate_ky

08/13/2013 at 10:18AM

11
#176 - joinvimgolf / @joinvimgolf

08/15/2013 at 02:00PM

11
#177 - Armand Halbert / @armandhalbert

08/17/2013 at 03:40AM

11
#178 - Kevin Etienne / @42__kevin

08/18/2013 at 06:57PM

11
#179 - Jeff Klein / @ravioli_jazz

08/19/2013 at 06:48PM

11
#180 - Dom Armstrong / @dom_cycleface

08/19/2013 at 09:59PM