mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-01 16:32:54 +03:00
17 lines
593 B
Plaintext
17 lines
593 B
Plaintext
hook global BufOpenFile .* %{ %sh{
|
|
if [ -z "${kak_opt_filetype}" ]; then
|
|
mime=$(file -b --mime-type "${kak_buffile}")
|
|
case "${mime}" in
|
|
application/*+xml) filetype="xml" ;;
|
|
image/*+xml) filetype="xml" ;; #SVG
|
|
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-option buffer filetype '%s'\n" "${filetype}"
|
|
fi
|
|
fi
|
|
} }
|