feat: default to available picker
This commit is contained in:
parent
13256a3acf
commit
46ebe4ded7
4 changed files with 23 additions and 16 deletions
|
|
@ -10,18 +10,28 @@ M.config = {
|
|||
M.http_codes = function()
|
||||
if M.config.use == 'telescope' then
|
||||
require('telescope').extensions.http.list(M.config.open_url)
|
||||
elseif M.config.use == 'fzf' then
|
||||
require('http-codes.fzf').pick(M.config.open_url)
|
||||
elseif M.config.use == 'fzf-lua' then
|
||||
require('http-codes.fzf-lua').pick(M.config.open_url)
|
||||
end
|
||||
end
|
||||
|
||||
M.setup = function(user_config)
|
||||
if
|
||||
user_config.use == nil
|
||||
or not vim.tbl_contains({ 'fzf', 'telescope' }, user_config.use)
|
||||
then
|
||||
if pcall(require, 'fzf-lua') then
|
||||
M.config.use = 'fzf-lua'
|
||||
elseif pcall(require, 'telescope') then
|
||||
M.config.use = 'telescope'
|
||||
end
|
||||
|
||||
if M.config.use == nil then
|
||||
vim.notify_once 'http-codes.nvim: install fzf-lua or telescope.nvim'
|
||||
return
|
||||
end
|
||||
|
||||
if user_config.use then M.config.use = user_config.use end
|
||||
|
||||
if not vim.tbl_contains({ 'fzf-lua', 'telescope' }, M.config.use) then
|
||||
vim.notify_once(
|
||||
'http-codes.nvim: must specify `use = {fzf,telescope}` in setup.',
|
||||
'http-codes.nvim: must specify `use = {fzf-lua,telescope}` in setup.',
|
||||
vim.log.levels.ERROR
|
||||
)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue