2015-09-11 16:37:39 +00:00
|
|
|
local AUTOJUMP_DIR = debug.getinfo(1, "S").source:match[[^@?(.*[\/])[^\/]-$]] .. "..\\AutoJump"
|
|
|
|
local AUTOJUMP_BIN_DIR = AUTOJUMP_DIR .. "\\bin"
|
2014-01-16 11:39:17 +00:00
|
|
|
local AUTOJUMP_BIN = (AUTOJUMP_BIN_DIR or clink.get_env("LOCALAPPDATA") .. "\\autojump\\bin") .. "\\autojump"
|
2014-01-12 19:34:28 +00:00
|
|
|
|
|
|
|
function autojump_add_to_database()
|
2015-09-11 16:37:39 +00:00
|
|
|
os.execute("python " .. "\"" .. AUTOJUMP_BIN .. "\"" .. " --add " .. "\"" .. clink.get_cwd() .. "\"" .. " 2> " .. clink.get_env("TEMP") .. "\\autojump_error.txt")
|
2014-01-12 19:34:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
clink.prompt.register_filter(autojump_add_to_database, 99)
|
2014-01-15 13:05:45 +00:00
|
|
|
|
|
|
|
function autojump_completion(word)
|
2015-09-11 16:37:39 +00:00
|
|
|
for line in io.popen("python " .. "\"" .. AUTOJUMP_BIN .. "\"" .. " --complete " .. word):lines() do
|
2014-01-15 13:05:45 +00:00
|
|
|
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)
|