Lower cased and dashed strings


Lower cased and dashed strings

As I have to generate big fixtures files, I wanted to find a way to format input data the way described by start and end files.

Especially the lower-cased-and-dashed ids
Not so good to find a pure Vim way, that's why I submit this challenge :wink:
Start file:

L么rem Ipsum
Auctor: eros (el茅mentum)
Tinc茂dunt, 芒c

End file:

    name: "L么rem Ipsum"
    name: "Dolor.eros"
    name: "Auctor: eros (el茅mentum)"
    name: "Tinc茂dunt, 芒c"

This one is already in the golf repo, but it鈥檚 from 2016 and 60 keystrokes vs Vim鈥檚 60, and I think we could do better.

57 (using tr*):

%S\n<ret>y`|tr -s '芒茅茂么 .(:,' aeio-<ret>A:<ret>name: "<c-r>""<esc><gt>%s\):<ret>hd,q
  • Yeah, I know in Vimgolf you aren鈥檛 allowed to use external programs, but external programs are kind of Kakoune鈥檚 philosophy.

56 without external programs:

%<a-s>yp`Hs\W+<ret>c-<esc>xs-?\n<ret>c:<ret>name: "<esc>A"<esc><gt>/[oeia]<ret>yxs[芒-么]<ret>R2<a-)>