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):
22
#1501 - Dennis Proksch / @DennisProksch

08/19/2018 at 04:41PM

23
#1502 - Eddie Monge / @eddiemonge

01/30/2012 at 07:13PM

23
#1503 - george  / @pa930

02/10/2012 at 10:23PM

23
#1504 - Igor / @trollmode

09/22/2015 at 09:00PM

23
#1505 - 杨洋 / @176795444

08/14/2017 at 12:02PM

23
#1506 - Omar Zeidan / @OZeidan97

11/14/2018 at 10:40AM

24
#1507 - Jakub Okoński / @farnoy

01/25/2012 at 02:39PM

24
#1508 - Steven Rosato / @steven_rosato

02/28/2012 at 08:17PM

24
#1509 - Jesse House / @house9twx

06/27/2013 at 12:42AM

24
#1510 - John Moon / @johnmoon6

11/18/2013 at 04:04AM

24
#1511 - Prasanna N / @SupertrampPras

09/19/2014 at 10:21AM

25
#1512 - Timothy Hahn / @timyhahn

04/20/2012 at 03:59AM

25
#1513 - Mark Zalar / @ZalarMark

04/24/2012 at 10:52AM

25
#1514 - Pablo / @chambawamba358

10/02/2013 at 01:52PM

25
#1515 - pawelmhm / @pawelmhm

03/01/2014 at 07:49PM

25
#1516 - Charles Neill / @ccneill

05/01/2014 at 01:30AM

25
#1517 - hashcookyz / @hashcookyz

08/23/2018 at 03:00PM

28
#1518 - John Hilliard / @praetorian

04/12/2012 at 08:47PM

28
#1519 - Peter Lustig / @LustigPeter42

07/29/2013 at 09:52PM

28
#1520 - Geoffrey Giesemann / @ggiesemann

08/16/2013 at 11:57AM

28
#1521 - Kevin James / @KevinKarruthers

11/20/2013 at 08:43PM

28
#1522 - Elijah Lynn / @ElijahLynn

07/31/2014 at 02:22PM

28
#1523 - Matt Walsh / @wattmalsh

02/08/2017 at 06:33AM

29
#1524 - Mike Korcynski / @mkorcy

02/04/2012 at 06:55PM

30
#1525 - Rap Game Dan Aykroyd / @rapdanaykroyd

04/26/2012 at 09:24PM

30
#1526 - Zudov / @zudov_me

02/04/2014 at 08:03PM

31
#1527 - Artur Chruszcz / @a_chru

09/15/2013 at 01:22PM

31
#1528 - Matt Vague / @mattvague

11/30/2013 at 11:17PM

33
#1529 - jonathanpberger / @jonathanpberger

01/30/2012 at 02:58AM

33
#1530 - skellam / @skellam

02/19/2012 at 05:11PM