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

1756 active golfers, 5101 entries

Leaderboard (lowest score wins):
12
#991 - Brendan Schaenzer / @bschaenzer

09/30/2020 at 02:07PM

12
#992 - Vildu / @Vildu3

09/30/2020 at 04:51PM

12
#993 - Ifeoluwa Lawal / @IfeLawl

10/07/2020 at 03:50PM

12
#994 - The Valencian Dev / @thevalenciandev

10/13/2020 at 03:52PM

12
#995 - dragonofdeath / @dragonofdeath8

10/16/2020 at 01:47PM

12
#996 - Rafael Gonzaga / @_rafaelgss

10/23/2020 at 04:18PM

12
#997 - chocolate / @chocola81394123

10/28/2020 at 02:12AM

12
#998 - quemeraisc / @quemeraisc

11/05/2020 at 04:22PM

12
#999 - Jake Grossman / @PiranaLaugh

11/12/2020 at 12:19AM

12
#1000 - roudens / @roudens2

12/07/2020 at 02:35PM

12
#1001 - hejhopp87 / @hejhopp87

12/13/2020 at 04:03PM

12
#1002 - Nedko Nedkov / @NedkoNedkov6

12/15/2020 at 06:18PM

12
#1003 - Marcio M Pereira / @iviarcio

01/27/2021 at 11:26PM

12
#1004 - Michel Viktor / @tomkpz

08/10/2021 at 12:35AM

12
#1005 - Jean George / @JeanGeo20504212

09/23/2021 at 07:41PM

12
#1006 - anakojm / @anakojm

07/13/2022 at 11:05PM

12
#1007 - z00master / @z00master

08/08/2022 at 08:42PM

12
#1008 - 우정민 / @jeongmin2021

10/08/2022 at 03:32PM

12
#1009 - かみひろ / @km_hr

02/04/2023 at 10:56AM

12
#1010 - Jakob Föger / @drvolcano86

02/17/2023 at 03:10PM

12
#1011 - rayx / @ray-x

12/05/2023 at 10:29AM

12
#1012 - Guru Senthil / @gurukoushik

06/28/2024 at 06:23PM

12
#1013 - Elliot Schemmel / @regulated

10/30/2024 at 08:19PM

12
#1014 - lassion / @mutilator630

02/12/2026 at 01:37PM

13
#1015 - Daniel Lundin / @danielundin

01/06/2012 at 09:54PM

13
#1016 - sutringonavira / @sutringonavira

01/13/2012 at 10:57AM

13
#1017 - Vladyslav Marsikov / @gagabogolo

01/17/2012 at 04:33PM

13
#1018 - Philippe Mongeau / @phmongeau

01/19/2012 at 02:28AM

13
#1019 - neerajsharma / @neerajsharma

01/25/2012 at 10:10AM

13
#1020 - Paweu1kZ nbNeyIhH / @yUQlwsFpRSzxJFh

01/26/2012 at 11:36PM