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

207 active golfers, 742 entries

Leaderboard (lowest score wins):
30
#1 - Urtica dioica / @udioica

01/04/2013 at 11:55PM

30
#2 - Adam Bell / @adamgbell

03/30/2013 at 04:06PM

30
#3 - Petro Тrouq / @zulolosi

06/01/2013 at 02:44AM

30
#4 - John Braxler / @braxler

03/27/2014 at 08:46PM

30
#5 - Ameen P / @Ameen_P1

06/18/2016 at 07:37AM

30
#6 - herbage / @herbage2

12/10/2016 at 07:09AM

30
#7 - sijinyuan / @sijinyuan

03/22/2017 at 02:32PM

30
#8 - Turkey Man / @lvturkeyman

11/23/2017 at 05:39PM

30
#9 - Dax / @zacoxi

12/06/2018 at 03:18AM

31
#10 - Mathieu Fortier / @mathieufortier

05/13/2012 at 03:16AM

31
#11 - sgfgdf / @sgfgdf

05/14/2012 at 03:26PM

31
#12 - Federico Galassi / @federicogalassi

05/15/2012 at 06:35AM

31
#13 - Tim Chase / @gumnos

05/17/2012 at 05:17PM

31
#14 - Forrest L Norvell / @othiym23

05/18/2012 at 05:55AM

31
#15 - Justin Love / @wondible

05/30/2012 at 04:05PM

31
#16 - Raúl Jara / @rauljara

07/06/2012 at 07:40PM

31
#17 - Wei Dai / @clvv42

07/12/2012 at 07:57PM

31
#18 - John Piasetzki / @jpiasetz

07/13/2012 at 04:55AM

31
#19 - Kerson Hsiao / @KersonHsiao

08/14/2012 at 07:39AM

31
#20 - Joseph J. Piché / @jjpiche

08/26/2012 at 01:01AM

31
#21 - Conner McDaniel / @connermcd

09/18/2012 at 04:37AM

31
#22 - Vim rocks / @vimrocks

10/07/2012 at 08:15PM

31
#23 - Victor Ramirez / @virako

10/16/2012 at 01:03AM

31
#24 - Trevor Powell / @DoomedBunnies

04/11/2013 at 05:21AM

31
#25 - Marco Hinz / @_mhinz_

05/21/2013 at 12:54PM

31
#26 - Bradd Szonye / @bszonye

07/11/2013 at 01:02PM

31
#27 - John Meisner / @jmeisned

06/26/2014 at 04:31AM

31
#28 - kimber gonzalez / @kimberlycreates

01/21/2015 at 10:06PM

31
#29 - pftb12345 / @pftb12345

04/14/2015 at 05:31AM

31
#30 - François Marais / @maraisf

07/11/2015 at 05:11PM