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

1478 active golfers, 4244 entries

Leaderboard (lowest score wins):
13
#1021 - Ryan van Rensburg / @rdvr001

07/21/2016 at 10:03AM

13
#1022 - Meninx / @_Meninx_

07/30/2016 at 11:48AM

13
#1023 - PeterGC / @petkusGC

08/14/2016 at 06:55PM

13
#1024 - Kyouma / @kyoumaJohn

10/14/2016 at 03:07PM

13
#1025 - Marcel Akkerman / @MarcelAkkerman

12/22/2016 at 07:40AM

13
#1026 - Hans Yelek / @hans_yelek

01/11/2017 at 04:01AM

13
#1027 - Yann / @yannstad

02/20/2017 at 08:56AM

13
#1028 - George / @Vge0rge

03/09/2017 at 05:45PM

13
#1029 - Daniel / @Daniel00288663

03/17/2017 at 09:40AM

13
#1030 - Reinaldo Astudillo / @astudillor

03/22/2017 at 11:19PM

13
#1031 - GVest Two / @GvestTwo

03/23/2017 at 07:03AM

13
#1032 - Joseph Satterfield™ / @joejsatterfield

06/29/2017 at 06:43PM

13
#1033 - grigouille / @grigouille2

07/04/2017 at 07:56PM

13
#1034 - Paul Sohn / @pksohn

09/04/2017 at 03:05PM

13
#1035 - ʎɐɹ / @staticjak

10/20/2017 at 09:14PM

13
#1036 - Spacesh1p / @spacesh1pdev

01/04/2018 at 09:17AM

13
#1037 - Immanuel Haffner / @ImmanuelHaffner

01/11/2018 at 05:14PM

13
#1038 - oceanarium / @oceanarium1

02/24/2018 at 02:32PM

13
#1039 - Râ Astons / @ra_astons

03/08/2018 at 04:43PM

13
#1040 - Raphaël Saunier / @RaphaelSaunier

03/08/2018 at 04:44PM

13
#1041 - Austin Ware / @AustinWare17

03/12/2018 at 08:42PM

13
#1042 - Tielman van Vuuren / @van_tielman

03/26/2018 at 12:20PM

13
#1043 - DHM / @DHM29978992

04/14/2018 at 12:16AM

13
#1044 - Kevin Durand / @kdthefakemvp

05/15/2018 at 04:31AM

13
#1045 - z0c / @zerocabal

06/11/2018 at 10:50AM

13
#1046 - mass / @mass256

07/09/2018 at 07:07AM

13
#1047 - niwatoco / @yoshitune9

07/19/2018 at 06:51PM

13
#1048 - 최종원 / @lastone9182

07/20/2018 at 12:50AM

13
#1049 - Hugo / @szeyattai

08/19/2018 at 03:41PM

13
#1050 - anon123 / @anon12373768670

08/28/2018 at 11:13AM