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):
40
#181 - captain_morgan / @captain_morgan

06/05/2012 at 09:51AM

40
#182 - Greg Sabo / @gregsabo

06/21/2012 at 04:38AM

40
#183 - Brandon Montgomery / @bmonty

06/23/2012 at 02:28PM

40
#184 - Federico Bond / @federicobond

07/22/2012 at 05:39AM

40
#185 - Jason Wolf / @zephyr_wolf

11/08/2012 at 05:34PM

40
#186 - powertomato / @powertomato

07/07/2013 at 07:22PM

40
#187 - curist / @curist

07/09/2013 at 02:54AM

40
#188 - David Pathakjee / @DavidPathakjee

08/14/2013 at 04:08AM

40
#189 - newton / @newtonsmartt

10/15/2013 at 08:10PM

40
#190 - Stefan Schmidt / @stafue

12/06/2013 at 11:34AM

40
#191 - Bill Booth / @ohiopyle

01/29/2014 at 11:39PM

40
#192 - João Paiva / @jgpaiva

01/31/2014 at 11:28AM

40
#193 - CJ Avilla / @cjav_dev

05/12/2014 at 07:04PM

40
#194 - John Bucephalus / @AaronHotz

10/18/2016 at 08:57AM

41
#195 - Daniel / @Daniel00288663

03/30/2017 at 04:00PM

41
#196 - Bruce Park / @bpark0

08/05/2018 at 09:21PM

42
#197 - noodl / @noodlet

11/02/2012 at 09:18AM

42
#198 - n0nick / @n0nick

11/19/2012 at 02:23PM

42
#199 - Dominick LoBraico / @pygatea

12/11/2012 at 11:21PM

42
#200 - Brian Besmanoff / @BrianBesmanoff

08/05/2013 at 01:34AM

43
#201 - Carlos Hernando / @chernando

06/13/2012 at 06:31PM

43
#202 - Viswanath Sivakumar / @viswanathgs

08/28/2012 at 12:03PM

43
#203 - Tj / @yrddy

08/19/2014 at 03:26AM

43
#204 - Jurica / @Jurica34581259

11/19/2018 at 09:20PM

43
#205 - jonas brothers lover / @grossiau

10/17/2020 at 10:01PM

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

07/20/2012 at 03:06PM

44
#207 - Hachez Floran / @FloranHachez

09/03/2013 at 05:55PM

45
#208 - Kubek2k / @kubek2k

05/23/2012 at 12:50PM

45
#209 - TimWolla / @TimWolla

06/09/2014 at 09:27PM

45
#210 - luffy / @raxcoi

06/07/2015 at 09:12PM