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

1548 active golfers, 4443 entries

Leaderboard (lowest score wins):
12
#811 - Constantine / @ConstantineHatz

09/22/2016 at 09:44PM

12
#812 - Daniel Bellenger / @DanielBellenger

09/30/2016 at 07:09PM

12
#813 - trx / @trxdbg

10/12/2016 at 04:39AM

12
#814 - timerella® / @timerella

11/17/2016 at 12:20AM

12
#815 - Etienne Florent / @EtienneFlorent

11/23/2016 at 03:24PM

12
#816 - BlackCap / @BlackCapCoder

11/23/2016 at 05:33PM

12
#817 - afinageny / @afinageny

12/17/2016 at 08:02PM

12
#818 - Michał Dytko / @DytkoM

12/20/2016 at 11:37AM

12
#819 - Douglas Roper / @dougdroper

12/20/2016 at 04:26PM

12
#820 - daHueby / @daHueby

01/11/2017 at 09:16AM

12
#821 - Yannick Novella / @ynovella

01/13/2017 at 02:33PM

12
#822 - jack / @jack28887741

02/24/2017 at 09:45AM

12
#823 - Raymond Chee / @rchomium

03/05/2017 at 04:20PM

12
#824 - Daniel Hjelm / @dhjelm

03/15/2017 at 10:32AM

12
#825 - caplod / @caplod

03/25/2017 at 02:47PM

12
#826 - Миша Сорокин / @rafmikovi4

04/10/2017 at 11:42AM

12
#827 - 20speedvegan / @ashkevinm

04/12/2017 at 06:41PM

12
#828 - Alex Linden / @alexwlinden1

05/02/2017 at 02:38PM

12
#829 - Sam Hammer / @samhammer325

05/06/2017 at 07:26AM

12
#830 - Edouard Piette / @EdPiette

05/19/2017 at 01:56PM

12
#831 - Ayush Sachdeva / @ayush000

06/05/2017 at 08:17PM

12
#832 - Carl Egbert / @CarlOEgbert

06/09/2017 at 10:10PM

12
#833 - Harsh Kumar / @datsleepyguy

07/09/2017 at 04:11PM

12
#834 - Lajos Koszti / @Ajnasz

09/20/2017 at 11:50AM

12
#835 - しぇぱっち / @shepabashi

10/23/2017 at 06:17AM

12
#836 - Ad Infinitum / @Ad_Inifinitum

11/13/2017 at 09:39PM

12
#837 - Brandon Blakeley / @zkelvin

11/25/2017 at 03:17AM

12
#838 - BareTull / @BareTull3

12/07/2017 at 06:54PM

12
#839 - Михаил Сурин / @realssmike

12/17/2017 at 10:00AM

12
#840 - Dominic Z / @thammaaa

01/11/2018 at 05:09PM