Fix filetype detection
The -i flag on Mac OS means: ჻ man file | grep -i -- -i -i If the file is a regular file, do not classify its contents. The --mime-type option is (mostly) portable: - Linux uses --mime-type - macOS uses --mime-type - FreeBSD uses --mime-type - NetBSD uses --mime-type - OpenBSD uses --mime-type and does not use the same implementation as everybody else - Solaris does not support MIME types at all
This commit is contained in:
parent
f666d8ec38
commit
99c09daec3
|
@ -1,6 +1,6 @@
|
||||||
hook global BufOpenFile .* %{ evaluate-commands %sh{
|
hook global BufOpenFile .* %{ evaluate-commands %sh{
|
||||||
if [ -z "${kak_opt_filetype}" ]; then
|
if [ -z "${kak_opt_filetype}" ]; then
|
||||||
mime=$(file -b -i -L "${kak_buffile}")
|
mime=$(file -b --mime-type -L "${kak_buffile}")
|
||||||
mime=${mime%;*}
|
mime=${mime%;*}
|
||||||
case "${mime}" in
|
case "${mime}" in
|
||||||
application/*+xml) filetype="xml" ;;
|
application/*+xml) filetype="xml" ;;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user