local GitPath="C:\\far-scripts" local F=far.Flags local K=far.Colors local elem=K.COL_COMMANDLINEPREFIX local tFarColor=far.AdvControl(F.ACTL_GETCOLOR,elem) local FC_bkp=tFarColor.ForegroundColor Event { group="FolderChanged"; description="FolderChanged"; action=function(Event,Data) local PanelDir=panel.GetPanelDirectory(handle,1) local GitBranch="" if PanelDir.Name:sub(1,-1)==GitPath then GitBranch='$S$C'..io.popen('git branch -a'):read("*all"):match("%* (%C+)")..'$F' tFarColor.ForegroundColor=14 else tFarColor.ForegroundColor=FC_bkp end far.AdvControl(F.ACTL_SETARRAYCOLOR,nil,{StartIndex=elem,--[[Flags="FSETCLR_REDRAW",]]tFarColor}) win.SetEnv("GITBRANCH",GitBranch) end } |