Skip to content

Commit

Permalink
Merge pull request #946 from gollth/graph-head-color
Browse files Browse the repository at this point in the history
  • Loading branch information
CKolkey authored Nov 22, 2023
2 parents df75660 + be708db commit 666e1c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions doc/neogit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ these yourself before the plugin loads, that will be respected. If they do not
exist, they will be created with sensible defaults based on your colorscheme.

STATUS BUFFER
NeogitBranch Header showing currently checked out branch
NeogitRemote Header showing current branch's remote (if set)
NeogitBranch Local branches
NeogitBranchHead Accent highlight for current HEAD in LogBuffer
NeogitRemote Remote branches
NeogitObjectId Object's SHA hash
NeogitStash Stash name
NeogitFold Folded text highlight
Expand Down
9 changes: 6 additions & 3 deletions lua/neogit/buffers/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,27 @@ M.CommitEntry = Component.new(function(commit, args)
remote_name, local_name = local_name, remote_name
end

local is_head = string.match(commit.ref_name, "HEAD %->") ~= nil
local branch_highlight = is_head and "NeogitBranchHead" or "NeogitBranch"

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 = "NeogitRemote" }))
table.insert(ref, text(local_name, { highlight = "NeogitBranch" }))
table.insert(ref, text(local_name, { highlight = branch_highlight }))
table.insert(ref, text(" "))
else
if local_name then
table.insert(
ref,
text(local_name, { highlight = local_name:match("/") and "NeogitRemote" or "NeogitBranch" })
text(local_name, { highlight = local_name:match("/") and "NeogitRemote" or branch_highlight })
)
table.insert(ref, text(" "))
end

if remote_name then
table.insert(
ref,
text(remote_name, { highlight = remote_name:match("/") and "NeogitRemote" or "NeogitBranch" })
text(remote_name, { highlight = remote_name:match("/") and "NeogitRemote" or branch_highlight })
)
table.insert(ref, text(" "))
end
Expand Down
1 change: 1 addition & 0 deletions lua/neogit/lib/hl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ function M.setup()
NeogitCommandCodeNormal = { link = "String" },
NeogitCommandCodeError = { link = "Error" },
NeogitBranch = { fg = palette.blue, bold = true },
NeogitBranchHead = { fg = palette.blue, bold = true, underline = true },
NeogitRemote = { fg = palette.green, bold = true },
NeogitUnmergedInto = { fg = palette.bg_purple, bold = true },
NeogitUnpushedTo = { fg = palette.bg_purple, bold = true },
Expand Down

0 comments on commit 666e1c6

Please sign in to comment.