From 7a756aaa4e1a30abb30a3869293ca1008e732607 Mon Sep 17 00:00:00 2001 From: Michael Lawson Date: Wed, 15 Jan 2014 13:05:45 +0000 Subject: [PATCH] add completion support --- bin/autojump.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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