Manual clone of yatline-githead.yazi for supporting yatline.yazi
The reason I modified this is because whenever I hovered on a .git directory
within a repo, the preview pane was flickering. I noticed that there were jobs
running (shown by w) which were Running fetchers for git on 19 target(s).
This was causing the flickering and so I used githead.yazi for inspiration to
manage the update of the git information.
Important
This repository has been created for my use case and I have no plans to update except for breaking changes. Working on Apple Silicon MBP M4 with minor issues, like not updating the info on the header bar when exiting a directory within the repo. Only works when entering the repo currently. One to work on. Details below are from the githead repo.
All supported features are listed here
- yazi version >= 23.3.2
- Font with symbol support. For example Nerd Fonts.
- yatline.yazi (Optional)
Manually close the repo to your plugins directory, usually at ~/.config/yazi/plugins/
Add this to your ~/.config/yazi/init.lua:
Important
If you are using yatline.yazi, put this after its initialization.
require("yatline-githead"):setup()Read more about indicators here.
Optionally, configuration:
require("githead"):setup({
show_branch = true,
branch_prefix = "on",
prefix_color = "white",
branch_color = "blue",
branch_symbol = "",
branch_borders = "()",
commit_color = "bright magenta",
commit_symbol = "@",
show_behind_ahead = true,
behind_color = "bright magenta",
behind_symbol = "⇣",
ahead_color = "bright magenta",
ahead_symbol = "⇡",
show_stashes = true,
stashes_color = "bright magenta",
stashes_symbol = "$",
show_state = true,
show_state_prefix = true,
state_color = "red",
state_symbol = "~",
show_staged = true,
staged_color = "bright yellow",
staged_symbol = "+",
show_unstaged = true,
unstaged_color = "bright yellow",
unstaged_symbol = "!",
show_untracked = true,
untracked_color = "blue",
untracked_symbol = "?",
})You can also use a theme:
local your_theme = {
prefix_color = "white",
branch_color = "blue",
commit_color = "bright magenta",
stashes_color = "bright magenta",
state_color = "red",
staged_color = "bright yellow",
unstaged_color = "bright yellow",
untracked_color = "blue",
}
require("githead"):setup({
-- ===
theme = your_theme,
-- ===
})If you are using yatline.yazi, you can use this component:
-- ===
{type = "coloreds", custom = false, name = "githead"},
-- ===- Current branch (or current commit if branch is not presented)
- Behind/Ahead of the remote
- Stashes
- States
- merge
- cherry
- rebase (+ done counter)
- Staged
- Unstaged
- Untracked
The goal is to use minimum amount of shell commands.
git status --ignore-submodules=dirty --branch --show-stashThis command provides information about branches, stashes, staged files, unstaged files, untracked files, and other statistics.