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):
39
#151 - jimdev / @jimdev2

05/25/2012 at 08:42AM

39
#152 - Ilya Strukov / @i1ey

05/26/2012 at 07:19AM

39
#153 - Benjamin Sergeant / @bsergean

06/05/2012 at 04:39AM

39
#154 - buz / @buzbone

06/15/2012 at 02:13AM

39
#155 - utopiah / @utopiah

06/18/2012 at 12:56PM

39
#156 - Benoit Thiell / @benoitthiell

07/23/2012 at 02:25PM

39
#157 - Greg Sexton / @greg_sexton

08/05/2012 at 08:15PM

39
#158 - Justin Le / @mstk

07/25/2013 at 07:02AM

39
#159 - Juan Luis / @rufianw

07/03/2014 at 03:14AM

39
#160 - Walker Boh / @walker_boh

10/13/2015 at 08:24AM

39
#161 - Gerald Tilma / @GeraldTilma

10/21/2015 at 02:07AM

39
#162 - Nicolas Nistal / @niconistal

11/19/2015 at 08:04PM

40
#163 - Richard Ramsden / @rramsden

05/07/2012 at 09:50PM

40
#164 - Neal Lindsay / @neall

05/10/2012 at 10:23PM

40
#165 - learninghang / @learninghang

05/17/2012 at 03:54AM

40
#166 - Chris Dahms / @zentrified

05/19/2012 at 11:10PM

40
#167 - captain_morgan / @captain_morgan

06/05/2012 at 09:51AM

40
#168 - Greg Sabo / @gregsabo

06/21/2012 at 04:38AM

40
#169 - Brandon Montgomery / @bmonty

06/23/2012 at 02:28PM

40
#170 - Federico Bond / @federicobond

07/22/2012 at 05:39AM

40
#171 - Jason Wolf / @zephyr_wolf

11/08/2012 at 05:34PM

40
#172 - powertomato / @powertomato

07/07/2013 at 07:22PM

40
#173 - curist / @curist

07/09/2013 at 02:54AM

40
#174 - David Pathakjee / @DavidPathakjee

08/14/2013 at 04:08AM

40
#175 - newton / @newtonsmartt

10/15/2013 at 08:10PM

40
#176 - Stefan Schmidt / @stafue

12/06/2013 at 11:34AM

40
#177 - Bill Booth / @ohiopyle

01/29/2014 at 11:39PM

40
#178 - João Paiva / @jgpaiva

01/31/2014 at 11:28AM

40
#179 - w1zeman1p / @wizemanip

05/12/2014 at 07:04PM

40
#180 - John Bucephalus / @AaronHotz

10/18/2016 at 08:57AM