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

1467 active golfers, 4212 entries

Leaderboard (lowest score wins):
11
#361 - David Nguyen / @nguydavi

06/06/2015 at 09:22AM

11
#362 - Nicholas McHenry / @n_mchenry

06/14/2015 at 04:50PM

11
#363 - Skúli Jóhannsson / @skulibj

06/26/2015 at 06:45PM

11
#364 - Louis Burke / @LambdaABeta

07/07/2015 at 05:15PM

11
#365 - Mutter Mumble / @muttermumble

07/10/2015 at 09:32AM

11
#366 - Dan Piponi / @sigfpe

07/22/2015 at 09:19PM

11
#367 - Daniel Beck / @daniel_beck_il

08/05/2015 at 05:09PM

11
#368 - Ferdev vimgolf / @fergvimgolf

08/11/2015 at 08:32AM

11
#369 - Peter B / @l0wm4x

08/17/2015 at 08:27PM

11
#370 - Liam Thurston / @lthurston188

08/18/2015 at 01:18AM

11
#371 - LC / @leeren

08/23/2015 at 12:15AM

11
#372 - Kirill Cherkashin / @kirjs

09/19/2015 at 10:00PM

11
#373 - Mikael Saltzman / @MikaelSaltzman

09/27/2015 at 01:19AM

11
#374 - Mike Adams / @davis_cromwell

09/30/2015 at 08:41PM

11
#375 - Walker Boh / @walker_boh

10/04/2015 at 01:15PM

11
#376 - Jon Krause / @jkrause314

10/06/2015 at 01:56AM

11
#377 - Daniel Pham / @dany_pham

10/16/2015 at 04:30AM

11
#378 - Smylers / @Smylers2

10/17/2015 at 09:48PM

11
#379 - Daniel Imhoff / @dwieeb

10/24/2015 at 08:40PM

11
#380 - Gavin Taqwaa / @chuckclayton_t1

10/27/2015 at 09:08PM

11
#381 - Pete Sevander / @Sevanteri

11/12/2015 at 12:21PM

11
#382 - JoeyLyn / @JJoofk

11/24/2015 at 02:32PM

11
#383 - Casey Pearring / @StandardBias

11/27/2015 at 09:18PM

11
#384 - Wilmer Bandres / @WilmerBandres

12/05/2015 at 11:26PM

11
#385 - ハチポケッツ / @8pockets

12/08/2015 at 11:52PM

11
#386 - Jiahan Wang / @hijiahanwang123

12/14/2015 at 09:02PM

11
#387 - Charlie / @wookie_giant

12/22/2015 at 09:30PM

11
#388 - Faat / @i_faat

12/30/2015 at 03:53PM

11
#389 - jackliusr / @jackliusr

01/13/2016 at 04:34AM

11
#390 - Jasbir Singh / @jasbirsingh11

01/16/2016 at 09:52PM