From efd3dda483aecf3f2bbd3f3c413013d2902bef1f Mon Sep 17 00:00:00 2001 From: Chris Grieser <73286100+chrisgrieser@users.noreply.github.com> Date: Sun, 21 Jan 2024 20:27:11 +0100 Subject: [PATCH] fix(highlights): use updated Treesitter capture groups (post 0.9.2) --- after/ftplugin/gitrebase.lua | 2 +- lua/tinygit/commands/commit-and-amend.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/after/ftplugin/gitrebase.lua b/after/ftplugin/gitrebase.lua index 3a84f4b..7162fbf 100644 --- a/after/ftplugin/gitrebase.lua +++ b/after/ftplugin/gitrebase.lua @@ -11,7 +11,7 @@ vim.fn.matchadd("tinygit_rebase_issueNumber", [[#\d\+]]) vim.api.nvim_set_hl(ns, "tinygit_rebase_issueNumber", { link = "Number" }) vim.fn.matchadd("tinygit_rebase_mdInlineCode", [[`.\{-}`]]) -- .\{-} = non-greedy quantifier -vim.api.nvim_set_hl(ns, "tinygit_rebase_mdInlineCode", { link = "@text.literal" }) +vim.api.nvim_set_hl(ns, "tinygit_rebase_mdInlineCode", { link = "@markup.raw.markdown_inline" }) vim.fn.matchadd( "tinygit_rebase_conventionalCommit", diff --git a/lua/tinygit/commands/commit-and-amend.lua b/lua/tinygit/commands/commit-and-amend.lua index fe307b7..eb5ad93 100644 --- a/lua/tinygit/commands/commit-and-amend.lua +++ b/lua/tinygit/commands/commit-and-amend.lua @@ -89,7 +89,7 @@ local function setupInputField(commitType) vim.api.nvim_set_hl(ns, "issueNumber", { link = "Number" }) fn.matchadd("mdInlineCode", [[`.\{-}`]]) -- .\{-} = non-greedy quantifier - vim.api.nvim_set_hl(ns, "mdInlineCode", { link = "@text.literal" }) + vim.api.nvim_set_hl(ns, "mdInlineCode", { link = "@markup.raw.markdown_inline" }) fn.matchadd("overLength", ([[.\{%s}\zs.*\ze]]):format(config.maxLen - 1)) vim.api.nvim_set_hl(ns, "overLength", { link = "ErrorMsg" }) @@ -106,7 +106,7 @@ local function setupInputField(commitType) -- treesitter highlighting vim.bo.filetype = "gitcommit" - vim.api.nvim_set_hl(ns, "@text.title.gitcommit", { link = "Normal" }) + vim.api.nvim_set_hl(ns, "@markup.heading.gitcommit", { link = "Normal" }) -- prevent auto-wrapping due to filetype "gitcommit" being set vim.opt_local.formatoptions:remove("t") @@ -172,7 +172,7 @@ local function commitNotification(title, stagedAllChanges, commitMsg, extra) -- using `matchadd`, since it is restricted to the current window anyway -- INFO the order the highlights are added matters, later has priority fn.matchadd("Number", [[#\d\+]]) -- issues number - fn.matchadd("@text.literal", [[`.\{-}`]]) -- inline code (.\{-} = non-greedy quantifier) + fn.matchadd("@markup.raw.markdown_inline", [[`.\{-}`]]) -- inline code (.\{-} = non-greedy quantifier) -- setting the filetype to "gitcommit" does not work well with -- nvim-notify, therefore manually highlighting conventional commits fn.matchadd(