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 5caf08f4a1c3e10009f19429

[Real World] PHP To Markdown

Fun refactoring I had to do in the real world. This presents several challenges: - How to create a table that fits the informations exactly - How to keep track of two informations per line while doing the refactoring - Generate the link from the actual text Have fun!

Start file
    public const SCHEMA_MAPPED_CONSTRAINTS = [
        Url::class => 'http://schema.org/url',
        Email::class => 'http://schema.org/email',
        Uuid::class => 'http://schema.org/identifier',
        CardScheme::class => 'http://schema.org/identifier',
        Bic::class => 'http://schema.org/identifier',
        Iban::class => 'http://schema.org/identifier',
        Date::class => 'http://schema.org/Date',
        DateTime::class => 'http://schema.org/DateTime',
        Time::class => 'http://schema.org/Time',
        Image::class => 'http://schema.org/image',
        File::class => 'http://schema.org/MediaObject',
        Currency::class => 'http://schema.org/priceCurrency',
        Isbn::class => 'http://schema.org/isbn',
        Issn::class => 'http://schema.org/issn',
    ];
End file
Constraints                                                                           | Vocabulary                        |
--------------------------------------------------------------------------------------|-----------------------------------|
[`Url`](https://symfony.com/doc/current/reference/constraints/Url.html)               | `http://schema.org/url`           |
[`Email`](https://symfony.com/doc/current/reference/constraints/Email.html)           | `http://schema.org/email`         |
[`Uuid`](https://symfony.com/doc/current/reference/constraints/Uuid.html)             | `http://schema.org/identifier`    |
[`CardScheme`](https://symfony.com/doc/current/reference/constraints/CardScheme.html) | `http://schema.org/identifier`    |
[`Bic`](https://symfony.com/doc/current/reference/constraints/Bic.html)               | `http://schema.org/identifier`    |
[`Iban`](https://symfony.com/doc/current/reference/constraints/Iban.html)             | `http://schema.org/identifier`    |
[`Date`](https://symfony.com/doc/current/reference/constraints/Date.html)             | `http://schema.org/Date`          |
[`DateTime`](https://symfony.com/doc/current/reference/constraints/DateTime.html)     | `http://schema.org/DateTime`      |
[`Time`](https://symfony.com/doc/current/reference/constraints/Time.html)             | `http://schema.org/Time`          |
[`Image`](https://symfony.com/doc/current/reference/constraints/Image.html)           | `http://schema.org/image`         |
[`File`](https://symfony.com/doc/current/reference/constraints/File.html)             | `http://schema.org/MediaObject`   |
[`Currency`](https://symfony.com/doc/current/reference/constraints/Currency.html)     | `http://schema.org/priceCurrency` |
[`Isbn`](https://symfony.com/doc/current/reference/constraints/Isbn.html)             | `http://schema.org/isbn`          |
[`Issn`](https://symfony.com/doc/current/reference/constraints/Issn.html)             | `http://schema.org/issn`          |

View Diff

1,16c1,17
<     public const SCHEMA_MAPPED_CONSTRAINTS = [
<         Url::class => 'http://schema.org/url',
<         Email::class => 'http://schema.org/email',
<         Uuid::class => 'http://schema.org/identifier',
<         CardScheme::class => 'http://schema.org/identifier',
<         Bic::class => 'http://schema.org/identifier',
<         Iban::class => 'http://schema.org/identifier',
<         Date::class => 'http://schema.org/Date',
<         DateTime::class => 'http://schema.org/DateTime',
<         Time::class => 'http://schema.org/Time',
<         Image::class => 'http://schema.org/image',
<         File::class => 'http://schema.org/MediaObject',
<         Currency::class => 'http://schema.org/priceCurrency',
<         Isbn::class => 'http://schema.org/isbn',
<         Issn::class => 'http://schema.org/issn',
<     ];
---
> Constraints                                                                           | Vocabulary                        |
> --------------------------------------------------------------------------------------|-----------------------------------|
> [`Url`](https://symfony.com/doc/current/reference/constraints/Url.html)               | `http://schema.org/url`           |
> [`Email`](https://symfony.com/doc/current/reference/constraints/Email.html)           | `http://schema.org/email`         |
> [`Uuid`](https://symfony.com/doc/current/reference/constraints/Uuid.html)             | `http://schema.org/identifier`    |
> [`CardScheme`](https://symfony.com/doc/current/reference/constraints/CardScheme.html) | `http://schema.org/identifier`    |
> [`Bic`](https://symfony.com/doc/current/reference/constraints/Bic.html)               | `http://schema.org/identifier`    |
> [`Iban`](https://symfony.com/doc/current/reference/constraints/Iban.html)             | `http://schema.org/identifier`    |
> [`Date`](https://symfony.com/doc/current/reference/constraints/Date.html)             | `http://schema.org/Date`          |
> [`DateTime`](https://symfony.com/doc/current/reference/constraints/DateTime.html)     | `http://schema.org/DateTime`      |
> [`Time`](https://symfony.com/doc/current/reference/constraints/Time.html)             | `http://schema.org/Time`          |
> [`Image`](https://symfony.com/doc/current/reference/constraints/Image.html)           | `http://schema.org/image`         |
> [`File`](https://symfony.com/doc/current/reference/constraints/File.html)             | `http://schema.org/MediaObject`   |
> [`Currency`](https://symfony.com/doc/current/reference/constraints/Currency.html)     | `http://schema.org/priceCurrency` |
> [`Isbn`](https://symfony.com/doc/current/reference/constraints/Isbn.html)             | `http://schema.org/isbn`          |
> [`Issn`](https://symfony.com/doc/current/reference/constraints/Issn.html)             | `http://schema.org/issn`          |
> 

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 6 remaining solutions by signing in and submitting your own entry
#7 Saki Gw / @Sakigw - Score: 183 - 04/11/19 @ 11:56
ddqqc0[`<Esc>lyewcth`](https://symfony.com/doc/current/reference/constraints/<C-R>0.html)|<Esc>99i <Esc>87|dwli `<Esc>Exs`|<Esc>99i <Esc>123|dw+q13@qS<Esc>{YPpVr-87|r|$r|-086r 011sConstraints<Esc>wwvaWr 10sVocabulary<Esc>ZZ

@Sakigw: To solvers: I recommend writing down your working solutions in another vim instance and copy-paste it into the vimgolf window. To avoid having to repeat such long key sequences without error.

@TitouanT_: how do you make it work ? when I try do it, it just past the text in the buffer without interpreting it

@Sakigw: Write your solution on a single line. Use <C-V><ESC> where you want to use <ESC>, same for other special keystrokes. Then what I do is visually select the line and yank it to the clipboard registry: 0v$"+y (of course I have a nnoremap for that). More tips by udioica on this kind of workflow: http://udioica.blogspot.com/2014/08/vimgolf-workflow.html

@mihaicristiant: Thanks for the info, was very useful. Still, I'm confused on how you get the keystokes from clipboard to vimgolf. Or you still have to write it by hand?

@Sakigw: Paste it using cmd+v on mac or ctrl+shift+v on linux. You might need to check if it works with your terminal. I used iTerm2 and Alacritty.

@mihaicristiant: Unfortunately, I get the same behavior as @TitouanT_ mentioned. Tested (on OSX) iTerm2, Alacritty, Kitty, Terminal.

6 comments


Created by: @Cydonia7

7 active golfers, 25 entries

Leaderboard (lowest score wins):
141
#1 - johnLate / @johnLate

06/14/2019 at 04:43AM

141
#2 - Martin Delille / @martinodelilo

08/21/2019 at 09:19AM

156
#3 - John Braxler / @braxler

04/12/2019 at 12:14PM

160
#4 - Smylers / @Smylers2

04/12/2019 at 10:09AM

164
#5 - Mihai / @mihaicristiant

04/12/2019 at 08:46AM

178
#6 - Titouan Teyssier / @TitouanT_

04/11/2019 at 08:33PM

183
#7 - Saki Gw / @Sakigw

04/11/2019 at 11:56AM