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

1478 active golfers, 4243 entries

Leaderboard (lowest score wins):
15
#1291 - Abdo Achkar / @Achkar

01/11/2015 at 12:11AM

15
#1292 - ಸುಬ್ರಹ್ಮಣ್ಯ ಜೋಶಿ / @subbucoding

03/29/2015 at 01:45PM

15
#1293 - Edgard Leal / @EdgardLeal

06/03/2015 at 07:09PM

15
#1294 - Kevin Knox / @kevinrknox

06/11/2015 at 07:31PM

15
#1295 - ggdGiBork:3^[:wq / @CopperBadger

10/06/2015 at 01:02AM

15
#1296 - Jay Hack / @_jayhack_

12/11/2015 at 08:47PM

15
#1297 - Stefan Sonski / @stefansonski

02/28/2016 at 05:23PM

15
#1298 - Joe Searle / @artouk

05/02/2016 at 03:16PM

15
#1299 - Jake S / @jakeseiden

05/13/2016 at 01:36PM

15
#1300 - Patrick Sanan / @patricksanan

01/18/2017 at 05:17PM

15
#1301 - Jacob Buete / @JBuete

07/04/2017 at 02:26AM

15
#1302 - Gurukandhamoorthi / @Gurukandhamoor1

07/10/2017 at 12:52PM

15
#1303 - Paul Inc / @hiniol1982

07/18/2017 at 07:34PM

15
#1304 - Robert Max Williams / @MaxPhurich

09/11/2017 at 10:29PM

15
#1305 - Jens C. Hansen / @jens_clh

11/21/2017 at 04:00PM

15
#1306 - 赤佐田奈葉 / @akasatanaha_

06/20/2018 at 07:08AM

15
#1307 - 3admin / @achtebaby

07/01/2018 at 08:01PM

15
#1308 - Kasparas Lavrukaitis / @kaslvr

11/07/2018 at 04:19PM

15
#1309 - Luis Rodriguez / @luisthecoder

11/14/2018 at 01:48AM

15
#1310 - beew71493 / @beew71493

12/26/2018 at 11:53AM

15
#1311 - Jasper Pangilinan / @JasperP

01/03/2019 at 11:46AM

15
#1312 - 강현 / @Applesquiz

01/27/2019 at 04:27PM

15
#1313 - Zach Miller / @barizachsy

02/27/2019 at 03:45AM

15
#1314 - zenwalker / @zenwalker93

03/10/2019 at 04:45PM

16
#1315 - Aljaž Srebrnič / @g5pw

01/30/2012 at 01:55PM

16
#1316 - Dave Smylie / @davesmylie

01/30/2012 at 09:38PM

16
#1317 - Cody Veal / @cjhveal

02/01/2012 at 07:47AM

16
#1318 - はなたん / @hntn

02/04/2012 at 12:41AM

16
#1319 - Martin Desrosiers / @mdesrosiers

02/21/2012 at 06:42AM

16
#1320 - Stormy Shippy / @Stormy

02/26/2012 at 11:49PM