Is it possible add Commnad()
in Header
function?
#1618
-
Hi I try to execute git command with function Header:gitbranch()
local status, err = Command('git')
:args({'--no-optional-locks', '-c', 'core.quotePath='})
:args({'status'})
:args({'--ignore-submodules=dirty', '--branch', '--show-stash', '--ahead-behind'})
:args({'2>nul'})
:stdout(Command.PIPED)
:output()
local branch = get_branch(status) -- get branch string
return ui.Line{
ui.Span(branch)
}
end It doesn't work without any response. Is there any way to execute git command asynchronously? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you want to show git branch name in the header, you can check out git.yazi, see how it is implemented there. I think you should make a seperate function and then do |
Beta Was this translation helpful? Give feedback.
If you want to show git branch name in the header, you can check out git.yazi, see how it is implemented there. I think you should make a seperate function and then do
Header.children_add(...)
for it to work as you want. You can also use starship.yazi, since it automatically shows git branch in a nice formatted way.