summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-05-05 15:03:00 +0200
committerThomas Vigouroux <tomvig38@gmail.com>2020-05-07 14:03:29 +0200
commit5dc5695413a2cce19938db963984926008cde139 (patch)
tree8bb2a4d818379802a1c59f15f795a0614f491e98 /lua/nvim-treesitter
parent2b3d4d21a815ec185ca896d83e505999ac53a047 (diff)
feat: support suggested highlights
Diffstat (limited to 'lua/nvim-treesitter')
-rw-r--r--lua/nvim-treesitter/highlight.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/highlight.lua b/lua/nvim-treesitter/highlight.lua
index 65ab48dc..9cf25963 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')