diff options
| author | Thomas Vigouroux <tomvig38@gmail.com> | 2020-05-05 15:03:00 +0200 |
|---|---|---|
| committer | Thomas Vigouroux <tomvig38@gmail.com> | 2020-05-07 14:03:29 +0200 |
| commit | 5dc5695413a2cce19938db963984926008cde139 (patch) | |
| tree | 8bb2a4d818379802a1c59f15f795a0614f491e98 /lua | |
| parent | docs: add contributig draft (diff) | |
| download | nvim-treesitter-5dc5695413a2cce19938db963984926008cde139.tar nvim-treesitter-5dc5695413a2cce19938db963984926008cde139.tar.gz nvim-treesitter-5dc5695413a2cce19938db963984926008cde139.tar.bz2 nvim-treesitter-5dc5695413a2cce19938db963984926008cde139.tar.lz nvim-treesitter-5dc5695413a2cce19938db963984926008cde139.tar.xz nvim-treesitter-5dc5695413a2cce19938db963984926008cde139.tar.zst nvim-treesitter-5dc5695413a2cce19938db963984926008cde139.zip | |
feat: support suggested highlights
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/highlight.lua | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/highlight.lua b/lua/nvim-treesitter/highlight.lua index 65ab48dcb..9cf259639 100644 --- a/lua/nvim-treesitter/highlight.lua +++ b/lua/nvim-treesitter/highlight.lua @@ -6,6 +6,47 @@ local M = { highlighters = {} } +local hlmap = vim.treesitter.TSHighlighter.hl_map + +-- Misc +hlmap.error = "Error" +hlmap["punctuation.delimiter"] = "Delimiter" +hlmap["punctuation.bracket"] = "Delimiter" + +-- Constants +hlmap["constant"] = "Constant" +hlmap["constant.builtin"] = "Special" +hlmap["constant.macro"] = "Define" +hlmap["string"] = "String" +hlmap["string.regex"] = "String" +hlmap["string.escape"] = "SpecialChar" +hlmap["character"] = "Character" +hlmap["number"] = "Number" +hlmap["boolean"] = "Boolean" +hlmap["float"] = "Float" + +-- Functions +hlmap["function"] = "Function" +hlmap["function.builtin"] = "Special" +hlmap["function.macro"] = "Macro" +hlmap["parameter"] = "Identifier" +hlmap["method"] = "Function" +hlmap["field"] = "Identifier" +hlmap["property"] = "Identifier" +hlmap["constructor"] = "Special" + +-- Keywords +hlmap["conditional"] = "Conditional" +hlmap["repeat"] = "Repeat" +hlmap["label"] = "Label" +hlmap["operator"] = "Operator" +hlmap["keyword"] = "Keyword" +hlmap["exception"] = "Exception" + +hlmap["type"] = "Type" +hlmap["type.builtin"] = "Type" +hlmap["structure"] = "Structure" + function M.attach(bufnr, ft) local buf = bufnr or api.nvim_get_current_buf() local ft = ft or api.nvim_buf_get_option(buf, 'ft') |
