[Refactor] Clean-up redundant module-load checks (#1011)

This commit is contained in:
kylo252 2021-08-15 17:38:47 +02:00 committed by GitHub
parent f36fd1907f
commit 6eb75c5678
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 57 deletions

View file

@ -1,5 +1,4 @@
local M = {}
local Log = require "core.log"
M.config = function()
lvim.builtin.which_key = {
active = false,
@ -230,14 +229,7 @@ M.config = function()
end
M.setup = function()
-- if not package.loaded['which-key'] then
-- return
-- end
local status_ok, which_key = pcall(require, "which-key")
if not status_ok then
Log:get_default "Failed to load whichkey"
return
end
local which_key = require "which-key"
which_key.setup(lvim.builtin.which_key.setup)
@ -247,10 +239,8 @@ M.setup = function()
local mappings = lvim.builtin.which_key.mappings
local vmappings = lvim.builtin.which_key.vmappings
local wk = require "which-key"
wk.register(mappings, opts)
wk.register(vmappings, vopts)
which_key.register(mappings, opts)
which_key.register(vmappings, vopts)
end
return M