Skip to content

Commit c0e4eca

Browse files
committed
Merge remote-tracking branch 'lenormf/rc/latex.kak'
2 parents 7679cdf + 89cfc46 commit c0e4eca

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

rc/extra/latex.kak

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# https://www.latex-project.org/
2+
#
3+
4+
# Detection
5+
# ‾‾‾‾‾‾‾‾‾
6+
7+
hook global BufSetOption mimetype=text/x-tex %{
8+
set buffer filetype latex
9+
}
10+
11+
hook global BufCreate .*\.tex %{
12+
set buffer filetype latex
13+
}
14+
15+
# Highlighters
16+
# ‾‾‾‾‾‾‾‾‾‾‾‾
17+
18+
addhl -group / regions -default content latex \
19+
comment '^%' '\n' ''
20+
21+
addhl -group /latex/comment fill comment
22+
# Scopes, starting with a backslash
23+
addhl -group /latex/content regex '\\\w+\>' 0:keyword
24+
# Options passed to scopes, between brackets
25+
addhl -group /latex/content regex '\\\w+\>\[([^]]+)\]' 1:value
26+
# Content between dollar signs/pairs
27+
addhl -group /latex/content regex '\$\$?[^$]+\$\$?' 0:magenta
28+
# Emphasized text
29+
addhl -group /latex/content regex '\\(emph|textit)\{([^}]+)\}' 2:default+i
30+
# Bold text
31+
addhl -group /latex/content regex '\\textbf\{([^}]+)\}' 1:default+b
32+
33+
# Initialization
34+
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
35+
36+
hook global WinSetOption filetype=latex %{
37+
addhl ref latex
38+
39+
set window comment_line_chars '%'
40+
}
41+
42+
hook global WinSetOption filetype=(?!latex).* %{
43+
rmhl latex
44+
}

0 commit comments

Comments
 (0)