Is there a way to enable filetype completion when setting buffer filetype?

Hi!

Is there a way to enable filetype completion when issuing a command set buffer filetype?

Or, maybe, just display a list of available filetypes, located in /usr/local/share/kak/rc/filetype?

Thank you!

I can think of a way to work it around with shell completions and a custom command, but I think that would be a nice thing to have by default

There’s not really a way to reliably complete filetypes, because there’s no actual list of them anywhere. The closest thing would be “the list of WinSetOption hooks with regexes that do not reject the string ‘filetype=’” and at best that would get you a list of regexes, not a list of strings. Most regex engines are geared towards “match this regex against this string”, not “generate strings that match this regex” especially since the number of matching strings could be infinite.

That said, I don’t think most people do very wild things with their filetype hooks, so teaching the set-option command to look at the list of registered WinSetOption hooks for ones with regexes that begin with the option name and grab the matching option value would get you 80% of the way there in practice. It might also be a horrible hack, I don’t know the code that well.