@@ -654,7 +654,7 @@ local function load_opts(opt)
654654end
655655
656656-- Load a plugin and its dependencies
657- function Plugin :load (opts )
657+ function Plugin :load ()
658658 if self .loaded then
659659 return true
660660 end
@@ -683,12 +683,12 @@ function Plugin:load(opts)
683683 if isdir (after_path ) then
684684 vim .opt .rtp :append (after_path )
685685 end
686+ self :load_scripts ()
686687 elseif self .is_lazy then
687688 -- For non-local lazy plugins, use packadd
688689 vim .cmd .packadd (self .plugin_name )
689690 end
690691
691- self :load_scripts ((opts and opts .script_cb ) and opts .script_cb or nil )
692692 self :call_setup ()
693693
694694 self .status = STATUS .LOADED
@@ -848,17 +848,15 @@ function Plugin:cmd(commands)
848848 pcall (api .nvim_del_user_command , cmd_name )
849849 local args = cmd_args .args ~= ' ' and ' ' .. cmd_args .args or ' '
850850 local bang = cmd_args .bang and ' !' or ' '
851- self :load ({
852- script_cb = function ()
853- if vim .fn .exists (' :' .. cmd_name ) == 2 then
854- --- @diagnostic disable-next-line : param-type-mismatch
855- local ok , err = pcall (vim .cmd , cmd_name .. bang .. args )
856- if not ok then
857- vim .notify (string.format (' execute %s wrong: %s' , cmd_name , err ), vim .log .levels .ERROR )
858- end
859- end
860- end ,
861- })
851+ self :load ()
852+
853+ if vim .fn .exists (' :' .. cmd_name ) == 2 then
854+ --- @diagnostic disable-next-line : param-type-mismatch
855+ local ok , err = pcall (vim .cmd , cmd_name .. bang .. args )
856+ if not ok then
857+ vim .notify (string.format (' execute %s wrong: %s' , cmd_name , err ), vim .log .levels .ERROR )
858+ end
859+ end
862860 end , {
863861 nargs = ' *' ,
864862 bang = true ,
0 commit comments