Skip to content

Commit dbfd004

Browse files
committed
fix: some plugin is not indexed
1 parent ebde1a3 commit dbfd004

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

lua/fzf-lua-extra/providers/store.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@ local utils = require('fzf-lua-extra.utils')
44
---@param cb fun(plugin: table, o: table)
55
local p_do = function(cb)
66
return function(selected, opts)
7+
if #selected == 0 then -- some plugin may not be included in registry
8+
local plugin = {}
9+
plugin.url = assert(FzfLua.get_last_query())
10+
plugin.full_name = plugin.url:gsub('https?://github.com/', '')
11+
plugin._config = string.format('return { %q, opts = {} }', plugin.full_name)
12+
local bs_parts = vim.split(plugin.full_name, '/', { trimempty = true })
13+
plugin.name = bs_parts[#bs_parts]
14+
cb(plugin, opts)
15+
return
16+
end
717
vim.iter(selected):each(function(sel)
818
sel = sel:match('[^%s]+')
9-
local bs_parts = vim.split(sel, '/')
19+
local bs_parts = vim.split(sel, '/', { trimempty = true })
1020
local name = bs_parts[#bs_parts]
1121
local plugin = utils.get_lazy_plugins()[name] or opts.previewer.items[sel]
1222
if plugin then cb(plugin, opts) end
@@ -126,7 +136,7 @@ local __DEFAULT__ = {
126136
local filepath = plugins_folder .. '/' .. (normname(p.name) .. '.lua')
127137
local res = utils.run(cmd, opts).stdout or ''
128138
local items = vim.json.decode(res).items
129-
write_conf({ config = items[p.full_name], filepath = filepath, repo = p })
139+
write_conf({ config = p._config or items[p.full_name], filepath = filepath, repo = p })
130140
end)
131141
end
132142
end),

0 commit comments

Comments
 (0)