Skip to content

Instantly share code, notes, and snippets.

@belisarius222
Created September 2, 2017 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save belisarius222/f70e325d781e9f0f8d3947571615c7d1 to your computer and use it in GitHub Desktop.
Save belisarius222/f70e325d781e9f0f8d3947571615c7d1 to your computer and use it in GitHub Desktop.
hoon syntax highlighting for kakoune
# Detection
#
hook global BufCreate .*[.](hoon) %{
set buffer filetype hoon
}
# Highlighters & Completion
#
add-highlighter -group / regions -default code hoon \
doq '"' (?<!\\)(\\\\)*" '' \
soq "'" (?<!\\)(\\\\)*' '' \
scol '::' '$' '' \
slus "\+\+\s(\s+)(\w|\-|\d)+" \s ''
add-highlighter -group /hoon/soq fill string
add-highlighter -group /hoon/doq fill string
add-highlighter -group /hoon/scol fill comment
add-highlighter -group /hoon/slus fill function
# Terms, constants, etc.
add-highlighter -group /hoon/code regex \%(\w|\-|\d)+ 0:value 1:value
add-highlighter -group /hoon/code regex \$(\w|\-|\d)+ 0:keyword 1:keyword
# Initialization
#
hook -group hoon-highlight global \
WinSetOption filetype=hoon %{ add-highlighter ref hoon }
hook -group hoon-highlight global WinSetOption \
filetype=(?!hoon).* %{ remove-highlighter hoon }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment