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

1500 active golfers, 4302 entries

Leaderboard (lowest score wins):
16
#1351 - Frettchen / @DayOfFrettchen

09/21/2013 at 03:08PM

16
#1352 - codegourmet / @codegourmet

10/02/2013 at 07:23AM

16
#1353 - Ian Oxley / @ianoxley

10/24/2013 at 01:49PM

16
#1354 - wilddog64 / @chengkai318

12/17/2013 at 05:51PM

16
#1355 - pikaren / @REALpikaren

12/21/2013 at 08:28AM

16
#1356 - Brian Peiris / @brianpeiris

12/28/2013 at 05:05AM

16
#1357 - Mohit Sharma / @m0hitsharma

12/30/2013 at 02:51AM

16
#1358 - Zhiyuan Shi / @zhiyuan_shi

01/01/2014 at 12:32PM

16
#1359 - Quota / @Quotad

01/10/2014 at 02:27PM

16
#1360 - ren / @wxoc

02/19/2014 at 10:53AM

16
#1361 - Bart / @oneofmanybarts

03/11/2014 at 03:09PM

16
#1362 - Aurélien Vallée / @aurelienvallee

04/29/2014 at 12:16PM

16
#1363 - Jorge Márquez Ortega / @Predicador001

05/21/2014 at 06:17PM

16
#1364 - Hendrik Lammers / @hendriklammers

06/14/2014 at 05:15PM

16
#1365 - Herr Oppermann / @HerrOppermann

06/15/2014 at 02:22PM

16
#1366 - liz monfett / @lizmonfett

07/05/2014 at 04:38AM

16
#1367 - AA / @stonewareslord

07/16/2014 at 03:27AM

16
#1368 - Jake Worth / @jwworth

11/23/2014 at 12:49AM

16
#1369 - Tact Overflow / @muppling

01/07/2015 at 01:35PM

16
#1370 - Dhuan!! / @sigadhuan

03/21/2015 at 04:29PM

16
#1371 - Chris Grantham / @crgrantham

11/30/2015 at 04:34PM

16
#1372 - kekke / @kekke859

01/23/2016 at 12:27PM

16
#1373 - Stop and think / @ms_uncountable

07/06/2017 at 07:17AM

16
#1374 - Bhatta Sushmith / @bsushmith

08/23/2017 at 08:28PM

16
#1375 - Paul Egy / @egy_paul

07/27/2018 at 04:14PM

16
#1376 - Daichi / @daichi1014

08/16/2018 at 03:53AM

16
#1377 - Anon / @Anon47554934

08/23/2018 at 02:13PM

16
#1378 - Laurent Atlan / @laurentatlan1

04/13/2019 at 11:50PM

16
#1379 - alaric27 / @alaric273

07/11/2019 at 08:54AM

17
#1380 - Bjørn Einar Bjartnes / @bjartnes

01/27/2012 at 12:19PM