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
#631 - Vinícius Hoyer / @viniciushoyer

10/23/2020 at 04:08PM

11
#632 - Sven H. / @mostley

11/02/2020 at 04:21PM

11
#633 - hepebexè / @hepebexe

11/22/2020 at 05:57PM

11
#634 - Brian :| / @Seeemplicity

12/25/2020 at 06:50AM

11
#635 - Kha Nguyen / @__ngtrongkha

12/30/2020 at 01:42AM

11
#636 - David / @imdavidhwang

12/30/2020 at 02:11AM

11
#637 - Sebastian Stephan / @DasFerd

01/02/2021 at 05:11PM

11
#638 - Dirty Harry / @TateDirty

01/04/2021 at 10:12PM

11
#639 - Jung Yeon Park / @park_jungy

01/08/2021 at 12:54AM

11
#640 - Björn Struckmeier / @BjrnStruckmeie1

01/08/2021 at 11:45AM

11
#641 - Ray Dennis / @raysden

01/08/2021 at 08:32PM

11
#642 - traplover / @traplov78528337

01/17/2021 at 07:25PM

11
#643 - lydxn / @lydxn1

07/25/2021 at 05:26AM

11
#644 - Nick Repetti / @nick_repetti

09/21/2021 at 06:39PM

11
#645 - Salvador Tojo Quintela / @SalvadorTojo

10/08/2021 at 07:02PM

11
#646 - Jacob Puthipiroj / @puthipiroj

11/15/2021 at 03:47PM

11
#647 - Flimsy Giraffe / @flimsy_giraffe

11/27/2021 at 09:34PM

11
#648 - POSIX / @po6ix

01/24/2022 at 02:54PM

11
#649 - blabla zincou / @BZincou

04/11/2022 at 10:09PM

11
#650 - russellzhaomao / @russellzhaomao

05/25/2022 at 05:07AM

11
#651 - x03n046 / @x03n046

06/07/2022 at 06:19AM

11
#652 - WbrL17 / @WbrL17

06/23/2022 at 08:20PM

11
#653 - Robert Newey / @wiseassbogan

07/09/2022 at 06:14AM

11
#654 - Andy Tockman / @atckmn

07/16/2022 at 03:51AM

11
#655 - Qing Liu / @poeminlash

08/07/2022 at 02:36PM

11
#656 - Brandon / @Brandon10678836

08/31/2022 at 11:25AM

11
#657 - Janzen / @__Coos

09/21/2022 at 03:30PM

11
#658 - AbhilashSreenivasa / @AbhilashSreeni7

09/25/2022 at 11:28PM

11
#659 - Andrii Soldatenko / @a_soldatenko

10/08/2022 at 04:31PM

11
#660 - 0xdaydream / @0xdaydream_

01/09/2023 at 04:09PM