vim: use vim.F.npcall
This commit is contained in:
parent
6a8c606845
commit
dcf75de3c0
4 changed files with 11 additions and 9 deletions
|
@ -11,8 +11,7 @@ local get_lazy = function()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(path)
|
vim.opt.rtp:prepend(path)
|
||||||
local _, lazy = pcall(require, 'lazy')
|
return vim.F.npcall(require, 'lazy')
|
||||||
return lazy
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local lazy = get_lazy()
|
local lazy = get_lazy()
|
||||||
|
|
|
@ -35,8 +35,8 @@ local config = function()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
local has_cmp, cmp = pcall(require, 'cmp_nvim_lsp')
|
local cmp = vim.F.npcall(require, 'cmp_nvim_lsp')
|
||||||
if has_cmp then
|
if cmp then
|
||||||
vim.tbl_deep_extend('force', opts.capabilities, cmp.default_capabilities())
|
vim.tbl_deep_extend('force', opts.capabilities, cmp.default_capabilities())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,12 @@ local config = function()
|
||||||
},
|
},
|
||||||
|
|
||||||
visual_multi = function()
|
visual_multi = function()
|
||||||
local ok, infos = pcall(vim.fn.VMInfos)
|
local info = vim.F.npcall(vim.fn.VMInfos)
|
||||||
if not ok or not infos.status then return '' end
|
if info and info.status then
|
||||||
return infos.current .. '/' .. infos.total .. ' ' .. infos.status
|
return info.current .. '/' .. info.total .. ' ' .. info.status
|
||||||
|
else
|
||||||
|
return ''
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
branch = {
|
branch = {
|
||||||
|
|
|
@ -17,8 +17,8 @@ local config = function()
|
||||||
['<c-k>'] = actions.cycle_history_prev,
|
['<c-k>'] = actions.cycle_history_prev,
|
||||||
}
|
}
|
||||||
|
|
||||||
local has_trouble, trouble = pcall(require, 'trouble.providers.telescope')
|
local trouble = vim.F.npcall(require, 'trouble.providers.telescope')
|
||||||
if has_trouble then
|
if trouble then
|
||||||
mappings['<c-b>'] = trouble.open_with_trouble
|
mappings['<c-b>'] = trouble.open_with_trouble
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue