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

1553 active golfers, 4453 entries

Leaderboard (lowest score wins):
11
#61 - Regine Labog / @LabogRegine

02/12/2012 at 07:46AM

11
#62 - Alexander Scherbinin / @realmyst

02/13/2012 at 11:15PM

11
#63 - gecko / @gecko655

02/15/2012 at 02:49PM

11
#64 - Greg Sabo / @gregsabo

02/15/2012 at 04:58PM

11
#65 - Oleg Roshupkin / @jjjahson

02/16/2012 at 02:59AM

11
#66 - Dan Huang / @yuzeh

02/16/2012 at 06:15AM

11
#67 - Ahn Wooseon / @ahnwooseon

02/16/2012 at 02:38PM

11
#68 - funkattack / @funkattack

02/17/2012 at 02:34PM

11
#69 - demon.mhm / @demonmhm

02/18/2012 at 12:09AM

11
#70 - Steven Sloss / @StevenSloss

02/19/2012 at 02:52AM

11
#71 - Nathaniel Cockburn / @NathanielCockbu

02/19/2012 at 03:27AM

11
#72 - David Sanders / @SandersCD

02/19/2012 at 04:23AM

11
#73 - Maciej Wos / @MaciejWos

02/21/2012 at 01:12PM

11
#74 - Federico Galassi / @federicogalassi

02/21/2012 at 01:36PM

11
#75 - Adrien Friggeri / @qelf

02/25/2012 at 05:15AM

11
#76 - Fabien Cazenave / @fabi1cazenave

02/25/2012 at 10:54AM

11
#77 - Clem / @clemst

02/26/2012 at 09:02PM

11
#78 - Augustin Trancart / @autra42

02/28/2012 at 05:01PM

11
#79 - Aaron Lake / @aaronmlake

02/28/2012 at 07:36PM

11
#80 - Ronie Uliana / @ronie

02/29/2012 at 03:43AM

11
#81 - Peter Anselmo / @peter_anselmo

03/02/2012 at 05:00PM

11
#82 - Patrick Mosby / @halbtuerke

03/02/2012 at 11:46PM

11
#83 - dominique pellé / @vimgolfisto

03/10/2012 at 06:00PM

11
#84 - Jomo / @yoyoyojomo

03/14/2012 at 05:17PM

11
#85 - John Anderson / @opejn

03/19/2012 at 02:10AM

11
#86 - Sergey Kim / @skim1776

03/24/2012 at 06:46PM

11
#87 - Anders Janmyr / @andersjanmyr

04/01/2012 at 09:21AM

11
#88 - Sebastian Kusnier / @skusnier

04/01/2012 at 08:45PM

11
#89 - Nathan Manousos / @trafnar

04/02/2012 at 06:05AM

11
#90 - Prody / @Prody225

04/02/2012 at 11:01AM