diff options
Diffstat (limited to 'lua/core')
-rw-r--r-- | lua/core/compe.lua | 7 | ||||
-rw-r--r-- | lua/core/dap.lua | 7 | ||||
-rw-r--r-- | lua/core/gitsigns.lua | 8 | ||||
-rw-r--r-- | lua/core/telescope.lua | 2 | ||||
-rw-r--r-- | lua/core/terminal.lua | 17 | ||||
-rw-r--r-- | lua/core/which-key.lua | 16 |
6 files changed, 11 insertions, 46 deletions
diff --git a/lua/core/compe.lua b/lua/core/compe.lua index c2f97e27..b5b37805 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -1,5 +1,4 @@ local M = {} -local Log = require "core.log" M.config = function() lvim.builtin.compe = { enabled = true, @@ -61,11 +60,7 @@ end M.setup = function() vim.g.vsnip_snippet_dir = lvim.vsnip_dir - local status_ok, compe = pcall(require, "compe") - if not status_ok then - Log:get_default().error "Failed to load compe" - return - end + local compe = require "compe" compe.setup(lvim.builtin.compe) diff --git a/lua/core/dap.lua b/lua/core/dap.lua index 4e21cc4c..259ff87e 100644 --- a/lua/core/dap.lua +++ b/lua/core/dap.lua @@ -1,5 +1,4 @@ local M = {} -local Log = require "core.log" M.config = function() lvim.builtin.dap = { active = false, @@ -13,11 +12,7 @@ M.config = function() end M.setup = function() - local status_ok, dap = pcall(require, "dap") - if not status_ok then - Log:get_default().error "Failed to load dap" - return - end + local dap = require "dap" vim.fn.sign_define("DapBreakpoint", lvim.builtin.dap.breakpoint) dap.defaults.fallback.terminal_win_cmd = "50vsplit new" diff --git a/lua/core/gitsigns.lua b/lua/core/gitsigns.lua index 9e023762..0c0efa91 100644 --- a/lua/core/gitsigns.lua +++ b/lua/core/gitsigns.lua @@ -1,5 +1,4 @@ local M = {} -local Log = require "core.log" M.config = function() lvim.builtin.gitsigns = { signs = { @@ -49,12 +48,7 @@ M.config = function() end M.setup = function() - local status_ok, gitsigns = pcall(require, "gitsigns") - if not status_ok then - Log:get_default().error "Failed to load gitsigns" - return - end - gitsigns.setup(lvim.builtin.gitsigns) + require("gitsigns").setup(lvim.builtin.gitsigns) end return M diff --git a/lua/core/telescope.lua b/lua/core/telescope.lua index 30533b65..d31edef9 100644 --- a/lua/core/telescope.lua +++ b/lua/core/telescope.lua @@ -1,5 +1,4 @@ local M = {} -local Log = require "core.log" function M.config() local status_ok, actions = pcall(require, "telescope.actions") if not status_ok then @@ -114,6 +113,7 @@ end function M.setup() local status_ok, telescope = pcall(require, "telescope") if not status_ok then + local Log = require "core.log" Log:get_default().error "Failed to load telescope" return end diff --git a/lua/core/terminal.lua b/lua/core/terminal.lua index 818038fd..661e5b3b 100644 --- a/lua/core/terminal.lua +++ b/lua/core/terminal.lua @@ -1,5 +1,4 @@ local M = {} -local Log = require "core.log" local utils = require "utils" M.config = function() @@ -46,22 +45,13 @@ M.config = function() end M.setup = function() - local status_ok, terminal = pcall(require, "toggleterm") - if not status_ok then - Log:get_default().error "Failed to load toggleterm" - print(terminal) - return - end + local terminal = require "toggleterm" for _, exec in pairs(lvim.builtin.terminal.execs) do require("core.terminal").add_exec(exec[1], exec[2], exec[3]) end terminal.setup(lvim.builtin.terminal) end -local function is_installed(exe) - return vim.fn.executable(exe) == 1 -end - M.add_exec = function(exec, keymap, name) vim.api.nvim_set_keymap( "n", @@ -85,8 +75,9 @@ end M._exec_toggle = function(exec) local binary = M._split(exec)[1] - if is_installed(binary) ~= true then - print("Please install executable " .. binary .. ". Check documentation for more information") + if vim.fn.executable(binary) ~= 1 then + local Log = require "core.log" + Log:get_default().error("Unable to run executable " .. binary .. ". Please make sure it is installed properly.") return end local Terminal = require("toggleterm.terminal").Terminal diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 66e3ffbb..04f892d8 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -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 |