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

1753 active golfers, 5093 entries

Leaderboard (lowest score wins):
15
#1531 - Luis Rodriguez / @luisthecoder

11/14/2018 at 01:48AM

15
#1532 - beew71493 / @beew71493

12/26/2018 at 11:53AM

15
#1533 - Jasper Pangilinan / @JasperP

01/03/2019 at 11:46AM

15
#1534 - 강현 / @Applesquiz

01/27/2019 at 04:27PM

15
#1535 - Zach Miller / @barizachsy

02/27/2019 at 03:45AM

15
#1536 - zenwalker / @zenwalker93

03/10/2019 at 04:45PM

15
#1537 - Josh Braun / @bbraunj

06/29/2019 at 06:14PM

15
#1538 - Vim Golfer / @VimGolfer6

08/08/2019 at 11:58PM

15
#1539 - Letto / @Letto02468680

10/31/2019 at 04:19PM

15
#1540 - Dan Horwood / @d_horwood

02/10/2020 at 06:58AM

15
#1541 - She3o at HOME / @Anas_She3sha3y

05/20/2020 at 11:46AM

15
#1542 - Di Liu / @Skyerliu

06/21/2020 at 03:09AM

15
#1543 - abhijeet patil / @abhijeetptl5

09/03/2020 at 03:05AM

15
#1544 - Jordan Martel / @martelosaurus

10/14/2020 at 04:35AM

15
#1545 - ms / @ms78270444

11/05/2020 at 11:39PM

15
#1546 - Gaston / @Gaston53635525

01/23/2021 at 08:25PM

15
#1547 - Bas / @m1tix

09/24/2022 at 01:12PM

15
#1548 - Alex Elarbee / @elarbee

10/17/2024 at 04:20AM

16
#1549 - Aljaž Srebrnič / @g5pw

01/30/2012 at 01:55PM

16
#1550 - Dave Smylie / @davesmylie

01/30/2012 at 09:38PM

16
#1551 - Cody Veal / @cjhveal

02/01/2012 at 07:47AM

16
#1552 - はなたん / @hntn

02/04/2012 at 12:41AM

16
#1553 - Martin Desrosiers / @mdesrosiers

02/21/2012 at 06:42AM

16
#1554 - Stormy Shippy / @Stormy

02/26/2012 at 11:49PM

16
#1555 - Lou Kosak / @hoverkraft

04/20/2012 at 01:05AM

16
#1556 - Bernhard Urban-Forster / @lewurm

06/24/2012 at 07:28PM

16
#1557 - Howard / @h0w412d

07/16/2012 at 02:55AM

16
#1558 - Ben Alpert / @soprano

07/17/2012 at 09:14AM

16
#1559 - Federico Bond / @federicobond

09/23/2012 at 04:53AM

16
#1560 - Maksim S. / @waynesayonara

07/28/2013 at 04:02PM