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):
37
#121 - Marcin Kulik / @sickill

05/02/2012 at 08:23AM

37
#122 - Nolen Royalty / @NolenRoyalty

05/06/2012 at 10:58PM

37
#123 - CyLiu / @CyLiu

05/14/2012 at 03:31AM

37
#124 - Stanley Wang / @stanleynwang

05/15/2012 at 06:43AM

37
#125 - Christopher Brew / @Seph1rothVII

05/18/2012 at 09:38PM

37
#126 - Tomas Frostensson / @frostensson

05/22/2012 at 03:33PM

37
#127 - keikun / @funkaloo

07/02/2012 at 07:24AM

37
#128 - jared miller / @jared_vim

03/02/2013 at 11:54PM

37
#129 - RobertT / @techrt2050

07/10/2013 at 11:28AM

37
#130 - gary.klindt@googlema / @garstekli

11/26/2013 at 01:01PM

37
#131 - Bambu / @bambumandinga

01/19/2014 at 05:26AM

37
#132 - Marcus Kellerman / @sharkusk

03/30/2014 at 07:18AM

37
#133 - Ram Tamtam / @ramtamtamtam

07/16/2014 at 02:04PM

37
#134 - Bill Ruddock / @biinari

05/03/2017 at 10:50PM

37
#135 - Rami Hovi / @hacker_lawyer

05/27/2017 at 10:03PM

37
#136 - majo senf / @majo_senf

06/24/2019 at 03:14PM

37
#137 - Ivo Blöchliger / @aigledesalpes

08/23/2019 at 01:35PM

37
#138 - Elliot Schemmel / @regulated

10/30/2024 at 01:52PM

38
#139 - Jonathan Lozinski / @jlozinski

05/02/2012 at 06:36AM

38
#140 - Renat Aksitov / @Korvin79

05/02/2012 at 02:48PM

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

05/06/2012 at 01:02PM

38
#142 - CoolWebTeacher / @coolwebteacher

05/07/2012 at 09:46PM

38
#143 - Arne Ehrlich / @typedlambda

05/09/2012 at 07:37PM

38
#144 - Evgeny Persienko / @zzazab

05/12/2012 at 05:07AM

38
#145 - Julio Silva / @9jb

05/14/2012 at 04:21PM

38
#146 - Jacob Vosmaer / @jacobvosmaer

06/03/2012 at 01:14PM

38
#147 - shutl_test / @shutl_test

06/06/2012 at 10:34AM

38
#148 - Jacek Wysocki / @ex00

06/14/2012 at 10:24AM

38
#149 - Glen / @Glen_S

07/21/2012 at 03:47AM

38
#150 - Ryan Patterson / @CGamesPlay

07/29/2012 at 05:41PM