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

213 active golfers, 776 entries

Leaderboard (lowest score wins):
31
#31 - pftb12345 / @pftb12345

04/14/2015 at 05:31AM

31
#32 - François Marais / @maraisf

07/11/2015 at 05:11PM

31
#33 - Jon Krause / @jkrause314

12/28/2015 at 05:06AM

31
#34 - Dimitar Dimitrov / @kurkale6ka

03/18/2016 at 03:57PM

31
#35 - DHM / @DHM29978992

04/30/2018 at 03:06AM

31
#36 - Mihai / @mihaicristiant

01/14/2019 at 01:05PM

31
#37 - Lory / @Lory46845742

11/26/2019 at 08:32AM

32
#38 - Fabien Pelletier / @FabPelletier

05/03/2012 at 02:14PM

32
#39 - Sebastian Kusnier / @skusnier

05/03/2012 at 07:23PM

32
#40 - Tibor Claassen / @codebeige

05/03/2012 at 07:34PM

32
#41 - ise0615 / @ise0615

05/04/2012 at 04:02PM

32
#42 - Sergey / @sav86

05/05/2012 at 12:44AM

32
#43 - Rod Knowlton / @codelahoma

05/05/2012 at 08:07PM

32
#44 - Brian Stolz / @tecnobrat

05/07/2012 at 09:55PM

32
#45 - Boyance / @Boyance_nl

05/09/2012 at 08:52PM

32
#46 - VimGolfDzNrSQleot / @VimGolfDzNrSQle

05/10/2012 at 09:03PM

32
#47 - Neil / @spameldoon

05/12/2012 at 02:23AM

32
#48 - Christian Gaida / @chgaida

05/12/2012 at 04:06PM

32
#49 - mnx / @mnxx

05/14/2012 at 01:26PM

32
#50 - Simon Nicolussi / @sinic

05/16/2012 at 09:48PM

32
#51 - magdzikk / @magdzikk1

05/18/2012 at 08:45PM

32
#52 - Matt Holden / @MatthewEvHolden

05/19/2012 at 07:01AM

32
#53 - Vasil Sakarov / @vsakarov

05/21/2012 at 05:34PM

32
#54 - Maksim S. / @waynesayonara

09/05/2012 at 07:17PM

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

10/09/2012 at 08:27PM

32
#56 - Joel Elkins / @dice_tea

03/06/2013 at 02:08PM

32
#57 - Casey Dwyer / @caseydwyer

10/25/2013 at 07:00PM

32
#58 - Joonas Pihlajamaa / @jokkebk

02/19/2014 at 11:55AM

33
#59 - Eric Weikl / @ericweikl

05/02/2012 at 07:22PM

33
#60 - Martin Aumueller / @aumuell

05/04/2012 at 07:36PM