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

1749 active golfers, 5079 entries

Leaderboard (lowest score wins):
11
#541 - əarth simulator / @eidoloncity

03/01/2019 at 04:36PM

11
#542 - alekfed / @alek_fed

04/15/2019 at 08:42AM

11
#543 - james_bunch / @james_bunch

04/16/2019 at 11:42PM

11
#544 - Michał Łowicki / @mlowicki

04/17/2019 at 08:43AM

11
#545 - Gitsnik / @dracyrys

04/22/2019 at 12:53PM

11
#546 - Michaël Lévesque-Dion / @mlevesquedion

04/25/2019 at 10:11PM

11
#547 - Grant / @grant_7788

04/30/2019 at 01:38AM

11
#548 - Kai.Li / @KaiLi19

05/07/2019 at 06:21AM

11
#549 - Arno / @arnoxmp

05/08/2019 at 08:36PM

11
#550 - ImaNotgate / @INotgate

05/09/2019 at 08:34PM

11
#551 - kakunpala / @kakun_pala

05/10/2019 at 09:22PM

11
#552 - Nick Yeow / @nickyeow

05/22/2019 at 02:19PM

11
#553 - alexandrasou / @alexandrasou2

05/22/2019 at 11:06PM

11
#554 - Lie Ryan / @lieryan

05/31/2019 at 09:14AM

11
#555 - deurzen / @devrzen

06/06/2019 at 02:03PM

11
#556 - Thomas Hickman / @thomaskhickman

06/08/2019 at 01:03PM

11
#557 - Sigurður Ægir Jónsso / @siggiae

06/11/2019 at 11:21PM

11
#558 - Magnus Bjuvensjö / @mbjuvensjo

06/12/2019 at 10:18PM

11
#559 - majo senf / @majo_senf

06/17/2019 at 11:58AM

11
#560 - mkaminaga / @mkmng3

06/28/2019 at 08:42AM

11
#561 - Miłosz Łakomy / @foobar01123

07/11/2019 at 12:19PM

11
#562 - Himavanth Reddy / @Himavanth1909

08/12/2019 at 08:58AM

11
#563 - Clint Caudle / @ClintCaudle

08/21/2019 at 02:48AM

11
#564 - Kenny Low / @kennylow

09/02/2019 at 02:59PM

11
#565 - Abnermtj / @Abnerjr19

09/09/2019 at 03:29AM

11
#566 - Vim Player / @PlayerVim

09/14/2019 at 01:29PM

11
#567 - Cassandra / @kascein

09/17/2019 at 07:44PM

11
#568 - vimgolfer / @vimgolfer7

09/30/2019 at 04:12AM

11
#569 - Rui Xue / @ruirayxue

10/01/2019 at 03:39AM

11
#570 - Chen-Hung Wu / @utah12005

10/02/2019 at 03:57AM