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

214 active golfers, 777 entries

Leaderboard (lowest score wins):
33
#61 - ミゲ / @tsumaranaikedo

05/05/2012 at 03:42AM

33
#62 - William Dunand / @wdunand

05/11/2012 at 02:34AM

33
#63 - quintin / @quintinjeannoel

05/30/2012 at 05:42PM

33
#64 - Dil / @dilpun

05/31/2012 at 12:24PM

33
#65 - Ryan O'Connell / @Salshammath

06/23/2012 at 02:55PM

33
#66 - Marcin Sza / @coot_

10/20/2013 at 12:07AM

33
#67 - name / @name65894813

11/30/2018 at 04:28PM

34
#68 - Ryan Arana / @cadetZemm

05/03/2012 at 01:33AM

34
#69 - Henri Wiechers / @hwiechers

05/03/2012 at 06:08AM

34
#70 - Son of Bongo / @bpcode

05/07/2012 at 02:58PM

34
#71 - Javier Blanco / @jbgutierrez

05/23/2012 at 06:43PM

34
#72 - Mohammed / @mbadran

05/25/2012 at 01:22PM

34
#73 -  Ikhsan Maulana / @ixandidu

08/18/2012 at 03:37PM

34
#74 - Mats Sigge / @MatsSigge

09/30/2012 at 07:50PM

34
#75 - Tyler / @tylerbindon

04/03/2013 at 05:34AM

34
#76 - Va bien te faire fou / @mplayer_vimgolf

11/16/2013 at 02:58AM

34
#77 - RB / @powerage88

04/19/2014 at 04:10PM

34
#78 - eBrnd / @eBrnd

11/03/2014 at 08:49PM

34
#79 - Jake Eskel / @JakeEskel

01/06/2015 at 11:21PM

35
#80 - h_east (トロッコ6個) / @h_east

05/02/2012 at 07:33AM

35
#81 - Tesnorth / @Tesnorth

05/02/2012 at 02:39PM

35
#82 - Daumantas / @dbaltrus

05/02/2012 at 11:54PM

35
#83 - Raj Sahae / @rajsahae

05/03/2012 at 12:06AM

35
#84 - Øystein Walle / @oysteinwalle

05/31/2012 at 06:14PM

35
#85 - Steven Occhipinti / @steveocchipinti

06/01/2012 at 04:12AM

35
#86 - Benoit Mortgat / @Benoit_Mortgat

06/05/2012 at 08:43PM

35
#87 - Benson Kim / @BensonRLA

06/06/2012 at 10:52AM

35
#88 - Yann Moisan / @YannMoisan

01/12/2013 at 06:03PM

35
#89 - Aaron Bieber / @aaronbieber

07/15/2013 at 10:58PM

35
#90 - Nathan / @NathanHarperoni

07/20/2013 at 03:45PM