Created
March 29, 2014 17:22
-
-
Save sweiss3/9858452 to your computer and use it in GitHub Desktop.
Revisions
-
sweiss3 created this gist
Mar 29, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ function git_checkout_match_generator(text, first, last) found_matches = false; if rl_state.line_buffer:find("^git checkout ") then has_start_branch = not rl_state.line_buffer:find("^git checkout[ ]*$") for line in io.popen("git branch 2>nul"):lines() do local m = line:match("[%* ] (.+)$") if m then if not has_start_branch then clink.add_match(m) found_matches = true; elseif #text > 0 and m:find(text) then clink.add_match(m) found_matches = true; end end end end return found_matches end clink.register_match_generator(git_checkout_match_generator, 10)