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
This commit is contained in:
parent
1bdf26fd6e
commit
85cd27138d
|
@ -1,16 +1,15 @@
|
||||||
decl str mimetype
|
|
||||||
|
|
||||||
hook global BufOpen .* %{ %sh{
|
hook global BufOpen .* %{ %sh{
|
||||||
if [ -z "${kak_opt_filetype}" ]; then
|
if [ -z "${kak_opt_filetype}" ]; then
|
||||||
mime=$(file -b --mime-type "${kak_buffile}")
|
mime=$(file -b --mime-type "${kak_buffile}")
|
||||||
case "${mime}" in
|
case "${mime}" in
|
||||||
|
application/*+xml) filetype="xml" ;;
|
||||||
|
message/rfc822) filetype="mail" ;;
|
||||||
|
text/x-shellscript) filetype="sh" ;;
|
||||||
text/x-*) filetype="${mime#text/x-}" ;;
|
text/x-*) filetype="${mime#text/x-}" ;;
|
||||||
text/*) filetype="${mime#text/}" ;;
|
text/*) filetype="${mime#text/}" ;;
|
||||||
esac
|
esac
|
||||||
if [ -n "${filetype}" ]; then
|
if [ -n "${filetype}" ]; then
|
||||||
printf "set buffer filetype '%s'\n" "${filetype}"
|
printf "set buffer filetype '%s'\n" "${filetype}"
|
||||||
else
|
|
||||||
printf "set buffer mimetype '%s'\n" "${mime}"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
} }
|
} }
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
# Detection
|
# Detection
|
||||||
# ‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
hook global BufSetOption mimetype=(text/((x-)?html|xml)|application/((\w+\+)?xml)) %{
|
hook global BufCreate .*\.html %{
|
||||||
set buffer filetype html
|
set buffer filetype html
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufCreate .*\.(html|xml) %{
|
hook global BufCreate .*\.xml %{
|
||||||
set buffer filetype html
|
set buffer filetype xml
|
||||||
}
|
}
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
|
@ -63,17 +63,17 @@ def -hidden _html_indent_on_new_line %{
|
||||||
# Initialization
|
# Initialization
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
hook -group html-highlight global WinSetOption filetype=html %{ addhl ref html }
|
hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ addhl ref html }
|
||||||
|
|
||||||
hook global WinSetOption filetype=html %{
|
hook global WinSetOption filetype=(?:html|xml) %{
|
||||||
hook window InsertEnd .* -group html-hooks _html_filter_around_selections
|
hook window InsertEnd .* -group html-hooks _html_filter_around_selections
|
||||||
hook window InsertChar .* -group html-indent _html_indent_on_char
|
hook window InsertChar .* -group html-indent _html_indent_on_char
|
||||||
hook window InsertChar \n -group html-indent _html_indent_on_new_line
|
hook window InsertChar \n -group html-indent _html_indent_on_new_line
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group html-highlight global WinSetOption filetype=(?!html).* %{ rmhl html }
|
hook -group html-highlight global WinSetOption filetype=(?!html|xml).* %{ rmhl html }
|
||||||
|
|
||||||
hook global WinSetOption filetype=(?!html).* %{
|
hook global WinSetOption filetype=(?!html|xml).* %{
|
||||||
rmhooks window html-indent
|
rmhooks window html-indent
|
||||||
rmhooks window html-hooks
|
rmhooks window html-hooks
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,6 @@ hook global BufCreate .+\.eml %{
|
||||||
set buffer filetype mail
|
set buffer filetype mail
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption mimetype=message/rfc822 %{
|
|
||||||
set buffer filetype mail
|
|
||||||
}
|
|
||||||
|
|
||||||
addhl -group / group mail
|
addhl -group / group mail
|
||||||
addhl -group /mail regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
|
addhl -group /mail regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
|
||||||
addhl -group /mail regex <[^@>]+@.*?> 0:string
|
addhl -group /mail regex <[^@>]+@.*?> 0:string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user