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):
31
#31 - Trevor Powell / @DoomedBunnies

04/11/2013 at 05:21AM

31
#32 - Marco Hinz / @_mhinz_

05/21/2013 at 12:54PM

31
#33 - Bradd Szonye / @bszonye

07/11/2013 at 01:02PM

31
#34 - John Meisner / @jmeisned

06/26/2014 at 04:31AM

31
#35 - kimber gonzalez / @kimberlycreates

01/21/2015 at 10:06PM

31
#36 - pftb12345 / @pftb12345

04/14/2015 at 05:31AM

31
#37 - Francois Marais / @maraisf

07/11/2015 at 05:11PM

31
#38 - Jon Krause / @jkrause314

12/28/2015 at 05:06AM

31
#39 - Dimitar Dimitrov / @kurkale6ka

03/18/2016 at 03:57PM

31
#40 - DHM / @DHM29978992

04/30/2018 at 03:06AM

31
#41 - Mihai / @mihaicristiant

01/14/2019 at 01:05PM

31
#42 - Lory / @Lory46845742

11/26/2019 at 08:32AM

31
#43 - Michel Viktor / @tomkpz

08/01/2021 at 01:40AM

31
#44 - Jean George / @JeanGeo20504212

02/01/2022 at 03:17PM

32
#45 - Fabien Pelletier / @FabPelletier

05/03/2012 at 02:14PM

32
#46 - Sebastian Kusnier / @skusnier

05/03/2012 at 07:23PM

32
#47 - Tibor Claassen / @codebeige

05/03/2012 at 07:34PM

32
#48 - ise0615 / @ise0615

05/04/2012 at 04:02PM

32
#49 - Sergey / @sav86

05/05/2012 at 12:44AM

32
#50 - Rod Knowlton / @codelahoma

05/05/2012 at 08:07PM

32
#51 - tecnobrat βšΎοΈπŸ‘¨β€πŸ’» Brian πŸ₯„πŸ‡¨πŸ‡¦ / @tecnobrat

05/07/2012 at 09:55PM

32
#52 - Boyance / @Boyance_nl

05/09/2012 at 08:52PM

32
#53 - VimGolfDzNrSQleot / @VimGolfDzNrSQle

05/10/2012 at 09:03PM

32
#54 - Neil / @spameldoon

05/12/2012 at 02:23AM

32
#55 - Christian Gaida / @chgaida

05/12/2012 at 04:06PM

32
#56 - mnx / @mnxx

05/14/2012 at 01:26PM

32
#57 - Simon Nicolussi / @sinic

05/16/2012 at 09:48PM

32
#58 - magdzikk / @magdzikk1

05/18/2012 at 08:45PM

32
#59 - Matt Holden / @MatthewEvHolden

05/19/2012 at 07:01AM

32
#60 - Vasil Sakarov / @vsakarov

05/21/2012 at 05:34PM