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):
25
#1711 - Pablo / @chambawamba358

10/02/2013 at 01:52PM

25
#1712 - pawelmhm / @pawelmhm

03/01/2014 at 07:49PM

25
#1713 - Charles Neill / @ccneill

05/01/2014 at 01:30AM

25
#1714 - hashcookyz / @hashcookyz

08/23/2018 at 03:00PM

25
#1715 - Koudougou / @OpenPatate

11/22/2020 at 08:19AM

28
#1716 - John Hilliard / @praetorian

04/12/2012 at 08:47PM

28
#1717 - Peter Lustig / @LustigPeter42

07/29/2013 at 09:52PM

28
#1718 - Geoffrey Giesemann / @ggiesemann

08/16/2013 at 11:57AM

28
#1719 - Kevin James / @KevinKarruthers

11/20/2013 at 08:43PM

28
#1720 - 🌱 Elijah Lynn🌱 / @ElijahLynn

07/31/2014 at 02:22PM

28
#1721 - Matt Walsh / @wattmalsh

02/08/2017 at 06:33AM

28
#1722 - MathijsHoogland / @MathijsHoogland

11/02/2020 at 09:53AM

29
#1723 - Mike Korcynski / @mkorcy

02/04/2012 at 06:55PM

29
#1724 - Jacob / @FuPingstar

02/01/2024 at 07:18PM

30
#1725 - Rap Game Dan Aykroyd / @rapdanaykroyd

04/26/2012 at 09:24PM

30
#1726 - Zudov / @zudov_me

02/04/2014 at 08:03PM

31
#1727 - Artur Chruszcz / @a_chru

09/15/2013 at 01:22PM

31
#1728 - Matt Vague / @mattvague

11/30/2013 at 11:17PM

31
#1729 - Sam Christensen / @samuelchriste

04/16/2020 at 02:43PM

33
#1730 - jonathanpberger / @jonathanpberger

01/30/2012 at 02:58AM

33
#1731 - skellam / @skellam

02/19/2012 at 05:11PM

33
#1732 - Asenar / @asenar

06/02/2012 at 04:18PM

33
#1733 - James / @jamgood96

07/26/2013 at 10:07PM

34
#1734 - Lee Quarella / @leequarella

02/21/2012 at 01:18AM

37
#1735 - Matthias Viehweger / @der_kronn

01/27/2012 at 05:58PM

37
#1736 - BitLad / @BitLad

04/06/2018 at 11:00AM

37
#1737 - cuanim / @cuanim02

02/25/2023 at 04:59AM

38
#1738 - Alberto Sadde / @titicox

11/09/2013 at 10:59AM

39
#1739 - Robert / @rockprofessor

01/15/2024 at 02:31PM

41
#1740 - Егор / @DG3GfGxuYOQZgxN

10/24/2018 at 04:45AM