vim: use vim.F.npcall

This commit is contained in:
Fernando Schauenburg 2023-08-06 23:52:57 +02:00
parent 6a8c606845
commit dcf75de3c0
4 changed files with 11 additions and 9 deletions

View file

@ -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()

View file

@ -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

View file

@ -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 = {

View file

@ -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