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

214 active golfers, 777 entries

Leaderboard (lowest score wins):
40
#181 - John Bucephalus / @AaronHotz

10/18/2016 at 08:57AM

41
#182 - Daniel / @Daniel00288663

03/30/2017 at 04:00PM

41
#183 - Bruce Park / @bpark0

08/05/2018 at 09:21PM

42
#184 - noodl / @noodlet

11/02/2012 at 09:18AM

42
#185 - n0nick / @n0nick

11/19/2012 at 02:23PM

42
#186 - Dominick LoBraico / @pygatea

12/11/2012 at 11:21PM

42
#187 - Brian Besmanoff / @BrianBesmanoff

08/05/2013 at 01:34AM

43
#188 - Carlos Hernando / @chernando

06/13/2012 at 06:31PM

43
#189 - Viswanath Sivakumar / @viswanathgs

08/28/2012 at 12:03PM

43
#190 - Tj / @yrddy

08/19/2014 at 03:26AM

43
#191 - Jurica / @Jurica34581259

11/19/2018 at 09:20PM

44
#192 - Eric Söderström / @eksoderstrom

07/20/2012 at 03:06PM

44
#193 - Hachez Floran / @FloranHachez

09/03/2013 at 05:55PM

45
#194 - Kubek2k / @kubek2k

05/23/2012 at 12:50PM

45
#195 - TimWolla / @TimWolla

06/09/2014 at 09:27PM

45
#196 - luffy / @raxcoi

06/07/2015 at 09:12PM

45
#197 - ltn614 / @ltn614

09/21/2015 at 08:58AM

46
#198 - Bart of Denver / @bartofdenver

08/12/2013 at 02:36PM

46
#199 - Gurukandhamoorthi / @Gurukandhamoor1

07/14/2017 at 05:01PM

47
#200 - a / @tztape

05/02/2012 at 09:13AM

47
#201 - tomazur_06 / @tomazur_06

05/03/2012 at 08:39PM

48
#202 - John Whitley / @johnwhitley

05/07/2012 at 09:10PM

48
#203 - Oliver Christ / @0liverChrist

09/25/2013 at 02:46PM

49
#204 - Paul Rosenzweig / @p9r

06/01/2012 at 09:06PM

50
#205 - Dave@Highgroove / @HighgrooveDave

05/22/2012 at 07:38PM

53
#206 - Ravi S Sinha / @ambidextrousTx

08/29/2012 at 09:38PM

55
#207 - Pavlo Klets / @p01nt

05/02/2012 at 10:01AM

55
#208 - Chris Brown / @engineercyb

07/31/2012 at 09:09PM

55
#209 - retired account / @retired10072015

08/20/2012 at 10:54AM

56
#210 - Asenar / @asenar

06/02/2012 at 04:10PM