From 99c09daec3908537492f9998aeb39bd07c59912c Mon Sep 17 00:00:00 2001 From: Matthias Margush Date: Fri, 21 Feb 2020 21:25:57 -0800 Subject: [PATCH] Fix filetype detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- rc/detection/file.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/detection/file.kak b/rc/detection/file.kak index d0f8ec5e..55fca1c8 100644 --- a/rc/detection/file.kak +++ b/rc/detection/file.kak @@ -1,6 +1,6 @@ hook global BufOpenFile .* %{ evaluate-commands %sh{ if [ -z "${kak_opt_filetype}" ]; then - mime=$(file -b -i -L "${kak_buffile}") + mime=$(file -b --mime-type -L "${kak_buffile}") mime=${mime%;*} case "${mime}" in application/*+xml) filetype="xml" ;;