1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-28 01:00:28 +03:00
kakoune/rc/filetype/asciidoc.kak
Alex Leferry 2 c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00

44 lines
1.7 KiB
Plaintext

# http://asciidoc.org/
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Detection
# ‾‾‾‾‾‾‾‾‾
hook global BufCreate .+\.(a(scii)?doc|asc) %{
set-option buffer filetype asciidoc
}
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/asciidoc group
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n={2,}\h*$ 0:title
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n-{2,}\h*$ 0:header
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n~{2,}\h*$ 0:header
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n\^{2,}\h*$ 0:header
add-highlighter shared/asciidoc/ regex (\A|\n\n)=\h+[^\n]+$ 0:title
add-highlighter shared/asciidoc/ regex (\A|\n\n)={2,}\h+[^\n]+$ 0:header
add-highlighter shared/asciidoc/ regex ^\h+([-\*])\h+[^\n]*(\n\h+[^-\*]\S+[^\n]*)*$ 0:list 1:bullet
add-highlighter shared/asciidoc/ regex ^(-{3,})\n[^\n\h].*?\n(-{3,})$ 0:block
add-highlighter shared/asciidoc/ regex ^(={3,})\n[^\n\h].*?\n(={3,})$ 0:block
add-highlighter shared/asciidoc/ regex ^(~{3,})\n[^\n\h].*?\n(~{3,})$ 0:block
add-highlighter shared/asciidoc/ regex ^(\*{3,})\n[^\n\h].*?\n(\*{3,})$ 0:block
add-highlighter shared/asciidoc/ regex \B(?:\+[^\n]+?\+|`[^\n]+?`)\B 0:mono
add-highlighter shared/asciidoc/ regex \b_[^\n]+?_\b 0:italic
add-highlighter shared/asciidoc/ regex \B\*[^\n]+?\*\B 0:bold
add-highlighter shared/asciidoc/ regex ^:[-\w]+: 0:meta
# Commands
# ‾‾‾‾‾‾‾‾
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{
add-highlighter window/asciidoc ref asciidoc
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/asciidoc }
}