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):
35
#91 - cj / @cj01101

08/07/2013 at 04:26AM

35
#92 - James / @Dronak

09/12/2013 at 07:59PM

35
#93 - Paul Draghicescu / @pdragy

05/10/2018 at 10:49PM

36
#94 - Daniel Lundin / @danielundin

05/02/2012 at 02:46PM

36
#95 - 無ん垢の叫び / @john_ababa

05/06/2012 at 04:48AM

36
#96 - Nicholas Kulikov / @abrakadabra

05/06/2012 at 11:43AM

36
#97 - francois bard / @misterfrb

05/07/2012 at 07:01AM

36
#98 - Robert Stump / @stumprm

05/08/2012 at 11:17AM

36
#99 - Dave C / @dmlc133

05/10/2012 at 09:25AM

36
#100 - Zygis Skulteckis / @zygis

05/27/2012 at 07:49AM

36
#101 - Matthew Clair / @CanadaRox

08/25/2012 at 09:05AM

36
#102 - Joe Nelson / @begriffs

09/03/2012 at 10:01PM

36
#103 - Jason Graham / @jason__graham

03/03/2013 at 12:49AM

36
#104 - Steve Tjoa / @stevetjoa

07/04/2013 at 06:31AM

36
#105 - Andrew Crites / @ExplosionPills

09/13/2013 at 01:56AM

36
#106 - Charlene Tshos / @charlymul

11/12/2013 at 07:35AM

36
#107 - Casper Christensen / @Casper__C

12/23/2013 at 01:43PM

36
#108 - Quota / @Quotad

01/22/2014 at 10:52AM

36
#109 - Helge Milde / @helgefmi

02/03/2014 at 03:10PM

36
#110 - TapTemplate / @TapTemplate

06/25/2014 at 01:01AM

36
#111 - Chenut Ludovic / @7Brwa7

04/05/2016 at 08:42AM

37
#112 - Marcin Kulik / @sickill

05/02/2012 at 08:23AM

37
#113 - Nolen Royalty / @NolenRoyalty

05/06/2012 at 10:58PM

37
#114 - CyLiu / @CyLiu

05/14/2012 at 03:31AM

37
#115 - Stanley Wang / @stanleynwang

05/15/2012 at 06:43AM

37
#116 - Christopher Brew / @Seph1rothVII

05/18/2012 at 09:38PM

37
#117 - Tomas Frostensson / @frostensson

05/22/2012 at 03:33PM

37
#118 - keikun / @funkaloo

07/02/2012 at 07:24AM

37
#119 - jared miller / @jared_vim

03/02/2013 at 11:54PM

37
#120 - RobertT / @techrt2050

07/10/2013 at 11:28AM