diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-06-01 00:22:59 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2020-06-14 13:09:38 +0200 |
| commit | 45ea0df21a8494c7a8258bbb98ebd510716148e9 (patch) | |
| tree | 7d6468805fb54b9cfcadb4b2c4e8de0e585d3cf5 | |
| parent | a06792450799f7cfe24cebac099cb47d640a2be3 (diff) | |
Add tree-sitter-regex
This might be interesting for injected highlighting
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | lua/nvim-treesitter/configs.lua | 7 | ||||
| -rw-r--r-- | queries/regex/highlights.scm | 29 |
3 files changed, 37 insertions, 0 deletions
@@ -180,6 +180,7 @@ List of currently supported languages: - [ ] yaml - [ ] nix - [ ] markdown +- [x] regex (maintained by @theHamsta) ## Troubleshooting Before doing anything run `:checkhealth nvim_treesitter`. This will help you find where the bug might come from. diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index f79fed00..f7b5ff2c 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -203,6 +203,13 @@ parsers.nix = { } } +parsers.regex = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-regex", + files = { "src/parser.c" } + } +} + -- @enable can be true or false -- @disable is a list of languages, only relevant if enable is true -- @keymaps list of user mappings for a given module if relevant diff --git a/queries/regex/highlights.scm b/queries/regex/highlights.scm new file mode 100644 index 00000000..48242543 --- /dev/null +++ b/queries/regex/highlights.scm @@ -0,0 +1,29 @@ +;; Forked from tree-sitter-regex +;; The MIT License (MIT) Copyright (c) 2014 Max Brunsfeld +[ + "(" + ")" + "(?" + "(?:" + "(?<" + ">" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +(group_name) @property + +[ + (identity_escape) + (control_letter_escape) + (character_class_escape) + (control_escape) + (start_assertion) + (end_assertion) + (boundary_assertion) + (non_boundary_assertion) +] @escape + +[ "*" "+" "|" "=" "<=" "!" "<!" ] @operator |
