Merge pull request #171 from Pocco81/dev-init

Securely call modules and disable all builtin plugin
This commit is contained in:
siduck76 2021-07-21 23:00:42 +05:30 committed by GitHub
commit 845ac0e615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 25 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("Error loading 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,7 +1,4 @@
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
@ -10,6 +7,3 @@ M.hideStuff = function()
]], ]],
false false
) )
end
return M