Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: 冷酔閑吟 <50296129+Jint-lzxy@users.noreply.github.com>
Signed-off-by: MiSumiSumi <dragon511southern@gmail.com>
  • Loading branch information
misumisumi and Jint-lzxy committed Aug 9, 2023
1 parent 98d7857 commit 57e91ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
14 changes: 6 additions & 8 deletions lua/core/pack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ function Lazy:load_plugins()
local list = {}
local plugins_list = vim.split(fn.glob(modules_dir .. "/plugins/*.lua"), "\n")
local user_plugins_list = vim.split(fn.glob(user_modules_dir .. "/plugins/*.lua"), "\n")
if user_plugins_list[1] ~= "" then
plugins_list = vim.list_extend(plugins_list, user_plugins_list)
if not vim.tbl_isempty(user_plugins_list) then
vim.list_extend(plugins_list, user_plugins_list)
end
if type(plugins_list) == "table" then
for _, f in ipairs(plugins_list) do
-- fill list with `plugins/*.lua`'s path used for later `require` like this:
-- list[#list + 1] = "plugins/completion.lua"
list[#list + 1] = f:sub(#modules_dir - 6, -1)
end
for _, f in ipairs(plugins_list) do
-- fill list with `plugins/*.lua`'s path used for later `require` like this:
-- list[#list + 1] = "plugins/completion.lua"
list[#list + 1] = f:sub(#modules_dir - 6, -1)
end
return list
end
Expand Down
8 changes: 4 additions & 4 deletions lua/modules/utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ function M.tobool(value)
end
end

---@param plugin_name string @Plugin name
---@param plugin_name string @Name of the plugin
---@param opts table @Default options for plugin
---@param isVimPlugin? boolean @If plugin is made by vimscript
---@param extraSetupFunc? function @When the plugin name that calls setup is different from `modules/configs/*.lua`
function M.load_plugin(plugin_name, opts, isVimPlugin, extraSetupFunc)
---@param vim_plugin? boolean @If this plugin is a Vimscript one
---@param setup_callback? function @Provide this if the plugin's setup function is not the usual one
function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback)
isVimPlugin = isVimPlugin or false
local ok, custom = pcall(require, "user.modules." .. plugin_name)
if ok then
Expand Down

0 comments on commit 57e91ca

Please sign in to comment.