mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-28 22:22:41 +03:00
f7e976676c
Centralize commenting functions into a single file, and declare variables used by those functions in language support files. The functions are `comment-selection` and `comment-line`, users should bind those functions to the keys of their liking for easy access.
36 lines
924 B
Plaintext
36 lines
924 B
Plaintext
# Detection
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
hook global BufSetOption mimetype=text/x-makefile %{
|
|
set buffer filetype makefile
|
|
}
|
|
|
|
hook global BufCreate [mM]akefile %{
|
|
set buffer filetype makefile
|
|
}
|
|
|
|
# Highlighters
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
addhl -group / regions -default content makefile \
|
|
comment '#' '$' '' \
|
|
eval '\$\(' '\)' '\('
|
|
|
|
addhl -group /makefile/comment fill comment
|
|
addhl -group /makefile/eval fill value
|
|
|
|
addhl -group /makefile/content regex ^[\w.%]+\h*:\s 0:identifier
|
|
addhl -group /makefile/content regex \b(ifeq|ifneq|else|endif)\b 0:keyword
|
|
addhl -group /makefile/content regex [+?:]= 0:operator
|
|
|
|
# Initialization
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
hook global WinSetOption filetype=makefile %{
|
|
addhl ref makefile
|
|
|
|
set window comment_selection_chars ""
|
|
set window comment_line_chars "#"
|
|
}
|
|
hook global WinSetOption filetype=(?!makefile).* %{ rmhl makefile }
|