1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-25 10:32:19 +03:00
kakoune/rc/base/file.kak
Maxime Coste 85cd27138d Remove mimetype option for good
file.kak now is responsible for mapping whatever mimetype file uses
to the filetype that Kakoune uses.

Fixes #975
Fixes #979
2016-12-14 13:40:00 +00:00

16 lines
534 B
Plaintext

hook global BufOpen .* %{ %sh{
if [ -z "${kak_opt_filetype}" ]; then
mime=$(file -b --mime-type "${kak_buffile}")
case "${mime}" in
application/*+xml) filetype="xml" ;;
message/rfc822) filetype="mail" ;;
text/x-shellscript) filetype="sh" ;;
text/x-*) filetype="${mime#text/x-}" ;;
text/*) filetype="${mime#text/}" ;;
esac
if [ -n "${filetype}" ]; then
printf "set buffer filetype '%s'\n" "${filetype}"
fi
fi
} }