Skip to content

Commit

Permalink
Merge pull request #46 from lnay/auto-pairs
Browse files Browse the repository at this point in the history
Improve paired delimiters which close themselves
  • Loading branch information
lnay authored Dec 15, 2024
2 parents fa8d55a + edaea78 commit 108253a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
28 changes: 23 additions & 5 deletions languages/latex/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,28 @@ name = "LaTeX"
grammar = "latex"
path_suffixes = ["tex", "latex", "sty", "cls"]
line_comments = ["%"]
autoclose_before = "$}]'"
autoclose_before = "$}]'\\"
brackets = [
{ start = "{", end = "}", close = true, newline = false },
{ start = "[", end = "]", close = true, newline = false },
{ start = "$", end = "$", close = true, newline = false },
{ start = "`", end = "'", close = true, newline = false },
{ start = "{", end = "}", close = true, newline = false, not_in = [
"comment",
] },
{ start = "\\[", end = "\\]", close = true, newline = true, not_in = [
"math",
"comment",
] },
{ start = "\\(", end = "\\)", close = true, newline = true, not_in = [
"math",
"comment",
] },
{ start = "[", end = "]", close = true, newline = false, not_in = [
"comment",
] },
{ start = "$", end = "$", close = true, newline = false, not_in = [
"math",
"comment",
] },
{ start = "`", end = "'", close = true, newline = false, not_in = [
"math",
"comment",
] },
]
15 changes: 15 additions & 0 deletions languages/latex/overrides.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
;; Math
[
(displayed_equation)
(inline_formula)
] @math

(math_environment
(_) @math)

;; Comments
[
(line_comment)
(block_comment)
(comment_environment)
] @comment.inclusive

0 comments on commit 108253a

Please sign in to comment.