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
#661 - Leonard Bereska / @LeonardBereska

02/19/2023 at 12:05PM

11
#662 - 咸糖🎯 / @GIA917229015

07/09/2023 at 01:52PM

11
#663 - b1gz / @_b1gz

07/12/2023 at 01:38AM

11
#664 - Hans Wurscht / @HansW313

09/18/2023 at 11:32AM

11
#665 - asirago / @asiragoo

12/12/2023 at 12:34AM

11
#666 - sosa-daniel / @sosa-daniel

12/29/2023 at 08:45AM

11
#667 - xiaoao1024 / @xiaoao1024

04/22/2024 at 11:16AM

11
#668 - Peppa Pig / @PeppaPigSg

05/25/2024 at 09:11AM

11
#669 - Petro Mudrievskyj / @petemud

07/01/2024 at 12:37PM

11
#670 - Suhaib Murshid / @suhaibm

09/21/2024 at 08:48AM

11
#671 - DayuanX / @DayuanX

10/09/2024 at 10:33AM

11
#672 - Magnus Wahlstrand / @magnuswahlstrand

12/27/2024 at 03:34PM

12
#673 - Joe Nerdan / @JoeNerdan

01/06/2012 at 06:16PM

12
#674 - sebtyp / @sebtyp

01/06/2012 at 08:41PM

12
#675 - Felipe Talavera / @flype

01/07/2012 at 01:50AM

12
#676 - Xavier Nayrac / @lkdjiin

01/08/2012 at 12:21PM

12
#677 - William Dunand / @wdunand

01/12/2012 at 06:01AM

12
#678 - bmamax / @bmamax

01/13/2012 at 10:22PM

12
#679 - Albin Olsson / @sentenser

01/15/2012 at 05:56PM

12
#680 - peter reisinger / @PeterReisinger

01/16/2012 at 04:18PM

12
#681 - Øystein Walle / @oysteinwalle

01/18/2012 at 05:42PM

12
#682 - maruyama / @tksmaru

01/22/2012 at 07:29AM

12
#683 - Pablo Raemdonck / @praemdonck

01/28/2012 at 11:58AM

12
#684 - Henri Gabriel / @workforpizza

01/29/2012 at 12:13AM

12
#685 - maxthoursie / @maxthoursie

01/30/2012 at 06:19PM

12
#686 - Dave E / @DaveRElliott

01/30/2012 at 09:35PM

12
#687 - Calvin Condon / @ccondon

01/31/2012 at 03:32AM

12
#688 - pangloss / @tpattern

01/31/2012 at 07:41AM

12
#689 - artanis / @artanislives

01/31/2012 at 02:02PM

12
#690 - Patrick Klingemann / @pklingem

01/31/2012 at 07:40PM