Merge pull request #171 from Pocco81/dev-init
Securely call modules and disable all builtin plugin
This commit is contained in:
commit
845ac0e615
19
init.lua
19
init.lua
|
@ -1,15 +1,24 @@
|
|||
require "options"
|
||||
|
||||
local chad_modules = {
|
||||
"pluginList",
|
||||
"plugins.bufferline",
|
||||
"mappings",
|
||||
"utils"
|
||||
}
|
||||
|
||||
local async
|
||||
async =
|
||||
vim.loop.new_async(
|
||||
vim.schedule_wrap(
|
||||
function()
|
||||
require "pluginList"
|
||||
require "plugins.bufferline"
|
||||
require "mappings"
|
||||
require("utils").hideStuff()
|
||||
|
||||
for i = 1, #chad_modules, 1 do
|
||||
local ok, res = xpcall(require, debug.traceback, chad_modules[i])
|
||||
if not (ok) then
|
||||
print("Error loading module : " .. chad_modules[i])
|
||||
print(res) -- print stack traceback of the error
|
||||
end
|
||||
end
|
||||
async:close()
|
||||
end
|
||||
)
|
||||
|
|
|
@ -46,16 +46,29 @@ g.mapleader = " "
|
|||
g.auto_save = false
|
||||
|
||||
-- disable builtin vim plugins
|
||||
g.loaded_gzip = 0
|
||||
g.loaded_tar = 0
|
||||
g.loaded_tarPlugin = 0
|
||||
g.loaded_zipPlugin = 0
|
||||
g.loaded_2html_plugin = 0
|
||||
g.loaded_netrw = 0
|
||||
g.loaded_netrwPlugin = 0
|
||||
g.loaded_matchit = 0
|
||||
g.loaded_matchparen = 0
|
||||
g.loaded_spec = 0
|
||||
local disabled_built_ins = {
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"gzip",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tar",
|
||||
"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 = {}
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
local M = {}
|
||||
|
||||
-- hide line numbers , statusline in specific buffers!
|
||||
M.hideStuff = function()
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
au TermOpen term://* setlocal nonumber laststatus=0
|
||||
|
@ -10,6 +7,3 @@ M.hideStuff = function()
|
|||
]],
|
||||
false
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Reference in New Issue