-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
extensions.lua
82 lines (64 loc) · 1.89 KB
/
extensions.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
return {
['ts-parsers'] = {
desc = 'List nvim-treesitter parsers. means installed. is not. Press to install/update them.',
command = function()
local parsers = require('nvim-treesitter.parsers').available_parsers()
local list = {}
local api = vim.api
for i, lang in pairs(parsers) do
local installed = #api.nvim_get_runtime_file('parser/' .. lang .. '.so', false) > 0
list[i] = {
text = string.format('%s %s', installed and '' or '', lang),
entry = { ordinal = lang },
lang = lang,
installed,
}
end
return list
end,
onSubmit = function(items)
if not vim.tbl_islist(items) then items = { items } end
local toInstall = {}
local toUpdate = {}
for _, item in pairs(items) do
if item.installed then
toUpdate[#toUpdate + 1] = item.lang
else
toInstall[#toInstall + 1] = item.lang
end
end
if #toInstall > 0 then vim.cmd.TSInstall(toInstall) end
if #toUpdate > 0 then vim.cmd.TSUpdate(toUpdate) end
end,
},
plugins = {
desc = 'List one plugins',
highlights = { tel_ext_i = { fg = '#51565C' }, tel_ext_plugin_desc = { fg = '#51565C' } },
-- See :h telescope.pickers.entry_display
format = { separator = ' ', items = { {}, {}, {} } },
command = function()
local one = require('one')
local list = {}
for i, plug in pairs(one.PM.plugs) do
local id = tostring(plug.id)
local desc = plug.desc
list[#list + 1] = {
id = id,
text = {
{ string.format('%3d', i), 'tel_ext_i' },
id,
{ desc and string.format('(%s)', desc) or '', 'tel_ext_plugin_desc' },
},
entry = { ordinal = id },
}
end
return list
end,
onSubmit = function(item)
if vim.tbl_islist(item) then error('Not support multiple selections') end
local one = require('one')
local path = one.PM.getPluginFolderPath(item.id)
vim.cmd.tabnew(path)
end,
},
}