Skip to content

Commit 8332b4a

Browse files
committed
improv(commit): adjust input message highlights for nvim 0.11
1 parent 2c3ab3c commit 8332b4a

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

lua/tinygit/commands/commit/msg-input.lua

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,13 @@ function M.new(mode, prompt, confirmationCallback)
208208
local nmaps = conf.keymaps.normal
209209
local hlgroup = { key = "Comment", desc = "NonText" }
210210
local keymapHints = {
211-
{ borderChar, "FloatBorder" }, -- extend border to align with padding
212-
{ " normal: ", hlgroup.desc },
213-
{ nmaps.confirm, hlgroup.key },
214-
{ " confirm ", hlgroup.desc },
215-
{ nmaps.abort, hlgroup.key },
211+
{ " normal: ", "FloatBorder" },
212+
{ " " .. nmaps.confirm, hlgroup.key },
213+
{ " confirm ", hlgroup.desc },
214+
{ " " },
215+
{ " " .. nmaps.abort, hlgroup.key },
216216
{ " abort ", hlgroup.desc },
217+
{ " " },
217218
}
218219

219220
local titleCharCount = {
@@ -271,9 +272,11 @@ function M.new(mode, prompt, confirmationCallback)
271272
end
272273

273274
-- STYLING
274-
-- no highlight, since we do that more intuitively with our separator is enough
275-
-- linking to original `Normal` hl looks better in some themes
276-
vim.wo[winid].winhighlight = "Normal:Normal,@markup.heading.gitcommit:,@markup.link.gitcommit:"
275+
-- 1. disable highlights, since we do that more intuitively with our separator
276+
-- 2. Linking to regular `Normal` looks better in nvim 0.10, but worse in 0.11
277+
local winHls = "@markup.heading.gitcommit:,@markup.link.gitcommit:"
278+
if vim.fn.has("nvim-0.11") == 0 then winHls = winHls .. ",Normal:Normal" end
279+
vim.wo[winid].winhighlight = winHls
277280

278281
vim.api.nvim_win_call(winid, function()
279282
highlight.inlineCodeAndIssueNumbers()

0 commit comments

Comments
 (0)