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

215 active golfers, 779 entries

Leaderboard (lowest score wins):
37
#121 - gary.klindt@googlema / @garstekli

11/26/2013 at 01:01PM

37
#122 - Bambu / @bambumandinga

01/19/2014 at 05:26AM

37
#123 - Marcus Kellerman / @sharkusk

03/30/2014 at 07:18AM

37
#124 - Ram Tamtam / @ramtamtamtam

07/16/2014 at 02:04PM

37
#125 - Bill Ruddock / @biinari

05/03/2017 at 10:50PM

37
#126 - Rami Hovi / @hacker_lawyer

05/27/2017 at 10:03PM

37
#127 - majo senf / @majo_senf

06/24/2019 at 03:14PM

37
#128 - Ivo Blöchliger / @aigledesalpes

08/23/2019 at 01:35PM

38
#129 - Jonathan Lozinski / @jlozinski

05/02/2012 at 06:36AM

38
#130 - Renat Aksitov / @Korvin79

05/02/2012 at 02:48PM

38
#131 - Jiří Chára / @JiriChara

05/06/2012 at 01:02PM

38
#132 - CoolWebTeacher / @coolwebteacher

05/07/2012 at 09:46PM

38
#133 - Arne Ehrlich / @typedlambda

05/09/2012 at 07:37PM

38
#134 - Evgeny Persienko / @zzazab

05/12/2012 at 05:07AM

38
#135 - Julio Silva / @9jb

05/14/2012 at 04:21PM

38
#136 - Jacob Vosmaer / @jacobvosmaer

06/03/2012 at 01:14PM

38
#137 - shutl_test / @shutl_test

06/06/2012 at 10:34AM

38
#138 - Jacek Wysocki / @ex00

06/14/2012 at 10:24AM

38
#139 - Glen / @Glen_S

07/21/2012 at 03:47AM

38
#140 - Ryan Patterson / @CGamesPlay

07/29/2012 at 05:41PM

38
#141 - JustGage / @JustGage

09/03/2012 at 03:10PM

38
#142 - Justin / @justinjaffray

05/17/2013 at 03:17PM

38
#143 - brett / @brettyukich

09/21/2013 at 03:12AM

38
#144 - Eric Potter / @pottereric

12/20/2013 at 02:44PM

38
#145 - Jason L. Shiffer / @zerotao

01/29/2014 at 01:56PM

38
#146 - Ali El Amine / @Allouch95

02/07/2014 at 03:15PM

38
#147 - Patrick Pitoscia / @Patrick03960431

08/07/2014 at 10:12PM

38
#148 - RockerZZY / @rocker_zzy

06/20/2020 at 11:54PM

39
#149 - vall / @provall1

05/04/2012 at 10:18AM

39
#150 - Tyler B / @DuderB

05/17/2012 at 01:54AM