-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
source.lua
53 lines (41 loc) · 1.03 KB
/
source.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--
-- compe-tmux
-- url: https://github.com/andersevenrud/compe-tmux
-- author: Anders Evenrud <andersevenrud@gmail.com>
-- license: MIT
--
local utils = require'compe_tmux.utils'
local Tmux = require'compe_tmux.tmux'
local source = {}
source.new = function()
local self = setmetatable({}, { __index = source })
local config = utils.create_compe_config()
self.tmux = Tmux.new(config)
return self
end
source.get_debug_name = function()
return 'tmux'
end
function source:is_available()
return self.tmux:is_enabled()
end
function source:get_keyword_pattern()
return [[\w\+]]
end
function source:get_trigger_characters()
return { '.' }
end
function source:complete(request, callback)
local items = self.tmux:complete(request.context.cursor_line)
if items == nil then
return callback()
end
callback(items)
end
function source:resolve(completion_item, callback)
callback(completion_item)
end
function source:execute(completion_item, callback)
callback(completion_item)
end
return source