feat: secure calls + disabled all builtin plugins

This commit is contained in:
Pocco81 2021-07-20 13:19:31 -05:00
parent 665fa24783
commit 355178a7bb
3 changed files with 39 additions and 26 deletions

View File

@ -1,15 +1,24 @@
require "options" require "options"
local chad_modules = {
"pluginList",
"plugins.bufferline",
"mappings",
"utils",
}
local async local async
async = async =
vim.loop.new_async( vim.loop.new_async(
vim.schedule_wrap( vim.schedule_wrap(
function() function()
require "pluginList" for i = 1, #chad_modules, 1 do
require "plugins.bufferline" local ok, res = xpcall(require, debug.traceback, chad_modules[i])
require "mappings" if not (ok) then
require("utils").hideStuff() print("NvChad [E0]: There was an error loading the module '" .. chad_modules[i] .. "' -->")
print(res) -- print stack traceback of the error
end
end
async:close() async:close()
end end
) )

View File

@ -46,16 +46,29 @@ g.mapleader = " "
g.auto_save = false g.auto_save = false
-- disable builtin vim plugins -- disable builtin vim plugins
g.loaded_gzip = 0 local disabled_built_ins = {
g.loaded_tar = 0 "netrw",
g.loaded_tarPlugin = 0 "netrwPlugin",
g.loaded_zipPlugin = 0 "netrwSettings",
g.loaded_2html_plugin = 0 "netrwFileHandlers",
g.loaded_netrw = 0 "gzip",
g.loaded_netrwPlugin = 0 "zip",
g.loaded_matchit = 0 "zipPlugin",
g.loaded_matchparen = 0 "tar",
g.loaded_spec = 0 "tarPlugin",
"getscript",
"getscriptPlugin",
"vimball",
"vimballPlugin",
"2html_plugin",
"logipat",
"rrhelper",
"spellfile_plugin"
}
for _, plugin in pairs(disabled_built_ins) do
vim.g["loaded_" .. plugin] = 1
end
local M = {} local M = {}

View File

@ -1,14 +1,5 @@
local M = {}
-- hide line numbers , statusline in specific buffers! -- hide line numbers , statusline in specific buffers!
M.hideStuff = function() vim.api.nvim_exec([[
vim.api.nvim_exec(
[[
au TermOpen term://* setlocal nonumber laststatus=0 au TermOpen term://* setlocal nonumber laststatus=0
au BufEnter,BufWinEnter,WinEnter,CmdwinEnter * if bufname('%') == "NvimTree" | set laststatus=0 | else | set laststatus=2 | endif au BufEnter,BufWinEnter,WinEnter,CmdwinEnter * if bufname('%') == "NvimTree" | set laststatus=0 | else | set laststatus=2 | endif
]], ]], false)
false
)
end
return M