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):
35
#91 - Daumantas / @dbaltrus

05/02/2012 at 11:54PM

35
#92 - Raj Sahae / @rajsahae

05/03/2012 at 12:06AM

35
#93 - Øystein Walle / @oysteinwalle

05/31/2012 at 06:14PM

35
#94 - Steven Occhipinti / @steveocchipinti

06/01/2012 at 04:12AM

35
#95 - Benoit Mortgat / @Benoit_Mortgat

06/05/2012 at 08:43PM

35
#96 - Benson Kim / @BensonRLA

06/06/2012 at 10:52AM

35
#97 - Yann Moisan / @YannMoisan

01/12/2013 at 06:03PM

35
#98 - Aaron Bieber / @aaronbieber

07/15/2013 at 10:58PM

35
#99 - Nathan / @NathanHarperoni

07/20/2013 at 03:45PM

35
#100 - cj / @cj01101

08/07/2013 at 04:26AM

35
#101 - James / @Dronak

09/12/2013 at 07:59PM

35
#102 - Paul Draghicescu / @pdragy

05/10/2018 at 10:49PM

36
#103 - Daniel Lundin / @danielundin

05/02/2012 at 02:46PM

36
#104 - じょんあば / @john_ababa

05/06/2012 at 04:48AM

36
#105 - Nicholas Kulikov / @abrakadabra

05/06/2012 at 11:43AM

36
#106 - francois bard / @misterfrb

05/07/2012 at 07:01AM

36
#107 - Robert Stump / @stumprm

05/08/2012 at 11:17AM

36
#108 - Dave C / @dmlc133

05/10/2012 at 09:25AM

36
#109 - Zygis Skulteckis / @zygis

05/27/2012 at 07:49AM

36
#110 - Matthew Clair / @CanadaRox

08/25/2012 at 09:05AM

36
#111 - Joe Nelson / @begriffs

09/03/2012 at 10:01PM

36
#112 - Jason Graham / @jason__graham

03/03/2013 at 12:49AM

36
#113 - Steve Tjoa / @stevetjoa

07/04/2013 at 06:31AM

36
#114 - Andrew Crites / @ExplosionPills

09/13/2013 at 01:56AM

36
#115 - Charlene Tshos / @charlymul

11/12/2013 at 07:35AM

36
#116 - Casper Christensen / @Casper__C

12/23/2013 at 01:43PM

36
#117 - Quota / @Quotad

01/22/2014 at 10:52AM

36
#118 - Helge Milde / @helgefmi

02/03/2014 at 03:10PM

36
#119 - TapTemplate / @TapTemplate

06/25/2014 at 01:01AM

36
#120 - Chenut Ludovic / @7Brwa7

04/05/2016 at 08:42AM