Lower cased and dashed strings


#1

http://www.vimgolf.com/challenges/55f9720b4a665c2acf0008c8

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
Dolor.eros
Auctor: eros (el茅mentum)
Tinc茂dunt, 芒c

End file:

lorem-ipsum:
    name: "L么rem Ipsum"
dolor-eros:
    name: "Dolor.eros"
auctor-eros-elementum:
    name: "Auctor: eros (el茅mentum)"
tincidunt-ac:
    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.


#2

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.

#3

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-)>