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
#511 - _Tpouhuk / @Tpouhuk2

08/08/2018 at 11:17PM

11
#512 - Frank Rifk / @r1fk

08/31/2018 at 04:16PM

11
#513 - Artūras Zakrevskis / @AZakrevskis

09/06/2018 at 02:38PM

11
#514 - Joao Figueiredo / @j1fig

09/06/2018 at 02:51PM

11
#515 - DustVoice / @DustVoice

09/10/2018 at 10:23AM

11
#516 - Bart3k / @Bart3k3

09/11/2018 at 11:15AM

11
#517 - Robin De Mol / @RobinDeMol

09/14/2018 at 08:59AM

11
#518 - Rasmus Bergström / @JRasmusBm

09/28/2018 at 10:41AM

11
#519 - John Oleksowicz / @JohnOlek

10/09/2018 at 08:02PM

11
#520 - Vasil Mikhalenya / @bazillek

10/15/2018 at 06:48PM

11
#521 - Benjamin Kiesl / @BenjaminKiesl

10/19/2018 at 08:26AM

11
#522 - Степанович Владислав / @Stepanovich98

10/23/2018 at 04:10PM

11
#523 - Alejandro Santander / @_ajsantander

10/25/2018 at 02:54AM

11
#524 - Dax / @zacoxi

11/02/2018 at 07:42AM

11
#525 - Fabio Branquinho / @branquif

11/08/2018 at 09:35PM

11
#526 - Michael Rose / @mdroseDev

11/23/2018 at 08:04AM

11
#527 - Performa / @performa6400

11/29/2018 at 05:44PM

11
#528 - Mihai / @mihaicristiant

12/03/2018 at 02:01PM

11
#529 - diwa / @Di_nate_

12/07/2018 at 09:19AM

11
#530 - guxbug / @guxbug1

12/21/2018 at 08:54AM

11
#531 - TimMcGuire / @mcguire

12/24/2018 at 04:40AM

11
#532 - Bart Kleijngeld / @BartKleijngeld

12/24/2018 at 09:40PM

11
#533 - antoine mas / @aneomas

01/06/2019 at 11:39AM

11
#534 - Oskar Fridell / @rax0m

01/08/2019 at 04:25PM

11
#535 - Stefano Bettani / @StefanoBettani

01/19/2019 at 05:38PM

11
#536 - abgalphabet / @abgalphabet

01/22/2019 at 01:47PM

11
#537 - xer0.5ive / @Bibekshah

02/02/2019 at 02:30PM

11
#538 - Sebastien Nicoud / @sebnukem

02/03/2019 at 10:48PM

11
#539 - Patrick Lavin / @LavinComputes

02/05/2019 at 10:41PM

11
#540 - Mateen Ulhaq / @sicariusnoctis

02/12/2019 at 04:14AM