Skip to content

Commit

Permalink
Make Neogit respect local and remote highlight groups
Browse files Browse the repository at this point in the history
  • Loading branch information
gollth committed Nov 14, 2023
1 parent 5ac8a37 commit a586d5b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lua/neogit/buffers/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,23 @@ M.CommitEntry = Component.new(function(commit, args)

if local_name and remote_name and vim.endswith(remote_name, local_name) then
local remote = remote_name:match("^([^/]*)/.*$")
table.insert(ref, text(remote .. "/", { highlight = "String" }))
table.insert(ref, text(local_name, { highlight = "Macro" }))
table.insert(ref, text(remote .. "/", { highlight = "NeogitRemote" }))
table.insert(ref, text(local_name, { highlight = "NeogitBranch" }))
table.insert(ref, text(" "))
else
if local_name then
table.insert(ref, text(local_name, { highlight = local_name:match("/") and "String" or "Macro" }))
table.insert(
ref,
text(local_name, { highlight = local_name:match("/") and "NeogitRemote" or "NeogitBranch" })
)
table.insert(ref, text(" "))
end

if remote_name then
table.insert(ref, text(remote_name, { highlight = remote_name:match("/") and "String" or "Macro" }))
table.insert(
ref,
text(remote_name, { highlight = remote_name:match("/") and "NeogitRemote" or "NeogitBranch" })
)
table.insert(ref, text(" "))
end
end
Expand Down

0 comments on commit a586d5b

Please sign in to comment.