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

1669 active golfers, 4806 entries

Leaderboard (lowest score wins):
12
#931 - fewfold / @fewfold

11/06/2019 at 03:02AM

12
#932 - Lory / @Lory46845742

11/08/2019 at 01:00PM

12
#933 - jake / @eyes_low

02/26/2020 at 01:14AM

12
#934 - Toby Hawkins / @Toby_Hawkins

03/17/2020 at 02:41AM

12
#935 - floyd / @floyd10086

03/17/2020 at 10:20AM

12
#936 - Quark / @PuzzleQuark

03/22/2020 at 06:30PM

12
#937 - Ryan Nevius / @ryannevius

03/24/2020 at 05:53AM

12
#938 - 薛浩滎 / @iTPChbTeI4ZW9s3

03/24/2020 at 08:49AM

12
#939 - Deepak Talan / @d02d33pak

04/07/2020 at 05:13PM

12
#940 - RaylanFox / @RaylanFox

04/13/2020 at 06:36PM

12
#941 - Sam Houston / @shouston33

07/29/2020 at 11:36PM

12
#942 - Martin Kauppinen / @MartinKauppinen

08/16/2020 at 02:18PM

12
#943 - This is a sniff free zone / @electronjunkie

08/16/2020 at 06:55PM

12
#944 - Greg Woodcock / @gregwoodcock

08/29/2020 at 12:15PM

12
#945 - mindgitrwx / @mindgitrwx

09/03/2020 at 05:40AM

12
#946 - Martin Bielik / @mabielik

09/06/2020 at 09:33PM

12
#947 - Nagy Zoltán / @nazzoli

09/12/2020 at 06:08PM

12
#948 - mevmev / @mevmev8

09/28/2020 at 10:10PM

12
#949 - Brendan Schaenzer / @bschaenzer

09/30/2020 at 02:07PM

12
#950 - Vildu / @Vildu3

09/30/2020 at 04:51PM

12
#951 - Ifeoluwa Lawal / @IfeLawl

10/07/2020 at 03:50PM

12
#952 - The Valencian Dev / @thevalenciandev

10/13/2020 at 03:52PM

12
#953 - dragonofdeath / @dragonofdeath8

10/16/2020 at 01:47PM

12
#954 - Rafael Gonzaga / @_rafaelgss

10/23/2020 at 04:18PM

12
#955 - chocolate / @chocola81394123

10/28/2020 at 02:12AM

12
#956 - quemeraisc / @quemeraisc

11/05/2020 at 04:22PM

12
#957 - Jake Grossman / @PiranaLaugh

11/12/2020 at 12:19AM

13
#958 - Daniel Lundin / @danielundin

01/06/2012 at 09:54PM

13
#959 - sutringonavira / @sutringonavira

01/13/2012 at 10:57AM

13
#960 - Vladyslav Marsikov / @gagabogolo

01/17/2012 at 04:33PM