Skip to content

Commit

Permalink
Merge non lazy plugins hook_source
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed May 13, 2024
1 parent 4b1981d commit 901d475
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
21 changes: 16 additions & 5 deletions denops/dpp/dpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ export class Dpp {

// Add plugins runtimepath
const depends = new Set<string>();
for (
const plugin of Object.values(recordPlugins).filter((plugin) =>
!plugin.lazy
)
) {
const nonLazyPlugins = Object.values(recordPlugins).filter((plugin) =>
!plugin.lazy
);
const hookSources = [];
for (const plugin of nonLazyPlugins) {
if (
!plugin.rtp || !await isDirectory(plugin.rtp) || !await checkIf(plugin)
) {
Expand All @@ -179,6 +179,10 @@ export class Dpp {
depends.add(depend);
}

if (plugin.hook_source) {
hookSources.push(plugin.hook_source);
}

await addRtp(plugin);
}

Expand All @@ -202,6 +206,10 @@ export class Dpp {
}

await addRtp(plugin);

if (plugin.hook_source) {
hookSources.push(plugin.hook_source);
}
}

rtps.splice(rtps.indexOf(runtimePath), 0, dppRuntimepath);
Expand Down Expand Up @@ -307,6 +315,9 @@ export class Dpp {
}
}

// Merge non lazy plugins hook_source
startupLines = startupLines.concat(hookSources);

// Write startup script
const startupFile = `${basePath}/${name}/startup.vim`;
await Deno.writeTextFile(startupFile, startupLines.join("\n"));
Expand Down
4 changes: 2 additions & 2 deletions doc/dpp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,8 @@ hook_source (String) or (Function)
It is executed after plugin runtimepath is added and before
the plugin script files are sourced.
It is mainly used for plugin configure.
NOTE: The "sourced" means after |dpp#min#load_state()| or when
|VimEnter| or autoloaded.
NOTE: The "sourced" means after |dpp#min#load_state()| or
autoloaded.

*dpp-plugin-option-lua_add*
lua_add (String)
Expand Down

0 comments on commit 901d475

Please sign in to comment.