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 4fa0d2fa2037000001000057

Exchanging Quotes

Sometimes you need to exchange a choice of quotes in some code.

Start file
mystring = 'This quoted string contains \' and is also'
           
'surrounded with \' characters.  It is also'
           
'a multiline string too'
End file
mystring = "This quoted string contains ' and used to be"
           
"surrounded with ' characters.  It is also"
           
"a multiline string too"

View Diff

1,3c1,3
< mystring = 'This quoted string contains \' and is also'
<            'surrounded with \' characters.  It is also'
<            'a multiline string too'
---
> mystring = "This quoted string contains ' and used to be"
>            "surrounded with ' characters.  It is also"
>            "a multiline string too"

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 229 remaining solutions by signing in and submitting your own entry
#230 Viktor Jackson / @AntiStalinista - Score: 87 - 05/05/12 @ 03:08
:%s# '# "#g<CR>:<Up><Left><Left><Left><Left><Left><Left><Left><Right><Right><Left><BS><Right>$<Right><Right><Right><CR>u:<Up><Left><Left><Left><BS><CR>:%s$<BS>#\\##g<CR>1G$3bt"3bct"and used to be<Esc>:w<CR>;q<CR>:q<CR>

0 comments


Created by: @jlozinski

230 active golfers, 858 entries

Leaderboard (lowest score wins):
32
#61 - Maksim S. / @waynesayonara

09/05/2012 at 07:17PM

32
#62 - Édouard M'tou / @DouardM

10/09/2012 at 08:27PM

32
#63 - Joel Elkins / @dice_tea

03/06/2013 at 02:08PM

32
#64 - Casey Dwyer / @caseydwyer

10/25/2013 at 07:00PM

32
#65 - Joonas Pihlajamaa / @jokkebk

02/19/2014 at 11:55AM

33
#66 - Eric Weikl / @ericweikl

05/02/2012 at 07:22PM

33
#67 - Martin Aumueller / @aumuell

05/04/2012 at 07:36PM

33
#68 - ミゲ / @tsumaranaikedo

05/05/2012 at 03:42AM

33
#69 - William Dunand / @wdunand

05/11/2012 at 02:34AM

33
#70 - quintin / @quintinjeannoel

05/30/2012 at 05:42PM

33
#71 - Dil / @dilpun

05/31/2012 at 12:24PM

33
#72 - Ryan O'Connell / @Salshammath

06/23/2012 at 02:55PM

33
#73 - Marcin Szamotulski / @me_coot

10/20/2013 at 12:07AM

33
#74 - name / @name65894813

11/30/2018 at 04:28PM

34
#75 - Ryan Arana / @cadetZemm

05/03/2012 at 01:33AM

34
#76 - Henri Wiechers / @hwiechers

05/03/2012 at 06:08AM

34
#77 - Son of Bongo / @bpcode

05/07/2012 at 02:58PM

34
#78 - Javier Blanco / @jbgutierrez

05/23/2012 at 06:43PM

34
#79 - Mohammed / @mbadran

05/25/2012 at 01:22PM

34
#80 -  Ikhsan Maulana / @ixandidu

08/18/2012 at 03:37PM

34
#81 - Mats Sigge / @MatsSigge

09/30/2012 at 07:50PM

34
#82 - Tyler / @tylerbindon

04/03/2013 at 05:34AM

34
#83 - Va bien te faire fou / @mplayer_vimgolf

11/16/2013 at 02:58AM

34
#84 - RB / @powerage88

04/19/2014 at 04:10PM

34
#85 - eBrnd / @eBrnd

11/03/2014 at 08:49PM

34
#86 - Jake Eskel / @JakeEskel

01/06/2015 at 11:21PM

34
#87 - Tuure / @tuure_p

05/16/2021 at 10:18PM

34
#88 - Janzen / @__Coos

09/26/2022 at 11:54AM

35
#89 - h_east (トロッコ6個) / @h_east

05/02/2012 at 07:33AM

35
#90 - Tesnorth / @Tesnorth

05/02/2012 at 02:39PM