Skip to content

Instantly share code, notes, and snippets.

@maple3142
Last active September 26, 2021 14:14
Show Gist options
  • Save maple3142/e553226d697e75c34518f3ca7fabec9e to your computer and use it in GitHub Desktop.
Save maple3142/e553226d697e75c34518f3ca7fabec9e to your computer and use it in GitHub Desktop.
clink show git branch
function show_git_branch()
for line in io.popen("git branch 2>nul"):lines() do
local m = line:match("%* (.+)$")
local b = "\x1b[32;22;49m".."("..m..")".."\x1b[39;22;49m"
if m then
clink.prompt.value = clink.prompt.value:gsub(">"," "..b.." >")
break
end
end
return false
end
clink.prompt.register_filter(show_git_branch, 50)
@zodman
Copy link

zodman commented Nov 28, 2019

@keocra your code works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment