diff options
author | kylo252 <[email protected]> | 2021-08-15 17:38:47 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-15 20:08:47 +0430 |
commit | 6eb75c5678ddb4d040f644e331e222078b99b3a1 (patch) | |
tree | 9830028d434cb9cc4e830346fc40ce392db29721 /lua/core/terminal.lua | |
parent | f36fd1907fd2480c766d96c65e1aebe69e5c855f (diff) |
[Refactor] Clean-up redundant module-load checks (#1011)
Diffstat (limited to 'lua/core/terminal.lua')
-rw-r--r-- | lua/core/terminal.lua | 17 |
1 files changed, 4 insertions, 13 deletions
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 |