diff --git a/bin/autojump.lua b/bin/autojump.lua index 1f3f869..91d425d 100644 --- a/bin/autojump.lua +++ b/bin/autojump.lua @@ -6,3 +6,15 @@ function autojump_add_to_database() end clink.prompt.register_filter(autojump_add_to_database, 99) + +function autojump_completion(word) + for line in io.popen("python " .. AUTOJUMP_BIN .. " --complete " .. word):lines() do + clink.add_match(line) + end + return {} +end + +local autojump_parser = clink.arg.new_parser() +autojump_parser:set_arguments({ autojump_completion }) + +clink.arg.register_parser("j", autojump_parser) \ No newline at end of file