fix: Fix fzf-lua registering as vim.ui.select
This commit is contained in:
parent
90706b4932
commit
ed898b6a48
1 changed files with 38 additions and 44 deletions
|
@ -86,6 +86,7 @@ projectPick = function()
|
|||
if choice == 1 then
|
||||
history.delete_project({ value = path })
|
||||
end
|
||||
---@diagnostic disable-next-line:need-check-nil
|
||||
projectPick()
|
||||
end,
|
||||
},
|
||||
|
@ -96,7 +97,8 @@ end
|
|||
|
||||
return {
|
||||
'fzf-lua',
|
||||
cmd = 'FzfLua',
|
||||
event = { 'DeferredUIEnter' },
|
||||
cmd = { 'FzfLua' },
|
||||
keys = {
|
||||
-- Find.
|
||||
{
|
||||
|
@ -180,49 +182,6 @@ return {
|
|||
{ '<LEADER>/', pick('live_grep'), desc = 'grep (root dir)' },
|
||||
{ '<LEADER>:', pick('command_history'), desc = 'command history' },
|
||||
},
|
||||
before_all = function()
|
||||
vim.ui.select = function(...)
|
||||
require('lz.n').trigger_load('fzf-lua')
|
||||
|
||||
require('fzf-lua').register_ui_select(function(fzf_opts, items)
|
||||
return vim.tbl_deep_extend('force', fzf_opts, {
|
||||
prompt = ' ',
|
||||
winopts = {
|
||||
title = ' '
|
||||
.. vim.trim((fzf_opts.prompt or 'Select'):gsub('%s*:%s*$', ''))
|
||||
.. ' ',
|
||||
title_pos = 'center',
|
||||
},
|
||||
}, fzf_opts.kind == 'codeaction' and {
|
||||
winopts = {
|
||||
layout = 'vertical',
|
||||
height = math.floor(
|
||||
math.min(vim.o.lines * 0.8 - 16, #items + 2) + 0.5
|
||||
) + 16,
|
||||
preview = not vim.tbl_isempty(
|
||||
vim.lsp.get_clients({ bufnr = 0, name = 'vtsls' })
|
||||
)
|
||||
and {
|
||||
layout = 'vertical',
|
||||
vertical = 'down:15,border-top',
|
||||
hidden = 'hidden',
|
||||
}
|
||||
or {
|
||||
layout = 'vertical',
|
||||
vertical = 'down:15,border-top',
|
||||
},
|
||||
},
|
||||
} or {
|
||||
winopts = {
|
||||
width = 0.5,
|
||||
height = math.floor(math.min(vim.o.lines * 0.8, #items + 2) + 0.5),
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
||||
return vim.ui.select(...)
|
||||
end
|
||||
end,
|
||||
after = function()
|
||||
local config = require('fzf-lua.config')
|
||||
local actions = require('fzf-lua.actions')
|
||||
|
@ -336,6 +295,41 @@ return {
|
|||
opts[1] = nil
|
||||
|
||||
require('fzf-lua').setup(opts)
|
||||
require('fzf-lua').register_ui_select(function(fzf_opts, items)
|
||||
return vim.tbl_deep_extend('force', fzf_opts, {
|
||||
prompt = ' ',
|
||||
winopts = {
|
||||
title = ' '
|
||||
.. vim.trim((fzf_opts.prompt or 'Select'):gsub('%s*:%s*$', ''))
|
||||
.. ' ',
|
||||
title_pos = 'center',
|
||||
},
|
||||
}, fzf_opts.kind == 'codeaction' and {
|
||||
winopts = {
|
||||
layout = 'vertical',
|
||||
height = math.floor(
|
||||
math.min(vim.o.lines * 0.8 - 16, #items + 2) + 0.5
|
||||
) + 16,
|
||||
preview = not vim.tbl_isempty(
|
||||
vim.lsp.get_clients({ bufnr = 0, name = 'vtsls' })
|
||||
)
|
||||
and {
|
||||
layout = 'vertical',
|
||||
vertical = 'down:15,border-top',
|
||||
hidden = 'hidden',
|
||||
}
|
||||
or {
|
||||
layout = 'vertical',
|
||||
vertical = 'down:15,border-top',
|
||||
},
|
||||
},
|
||||
} or {
|
||||
winopts = {
|
||||
width = 0.5,
|
||||
height = math.floor(math.min(vim.o.lines * 0.8, #items + 2) + 0.5),
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
||||
-- LSP keybinds.
|
||||
MarleyVim.lsp.on_attach(function(client)
|
||||
|
|
Loading…
Reference in a new issue