Last active
September 26, 2021 14:14
-
-
Save maple3142/e553226d697e75c34518f3ca7fabec9e to your computer and use it in GitHub Desktop.
clink show git branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@keocra your code works!