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