-
-
Save raa0121/d8634a7971ec95fb5fcbcb6baad27f65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
BaseConfig, | |
ContextBuilder, | |
Dpp, | |
Plugin, | |
} from "https://deno.land/x/dpp_vim@v0.0.2/types.ts"; | |
import { Denops, fn } from "https://deno.land/x/dpp_vim@v0.0.2/deps.ts"; | |
export class Config extends BaseConfig { | |
override async config(args: { | |
denops: Denops; | |
contextBuilder: ContextBuilder; | |
basePath: string; | |
dpp: Dpp; | |
}): Promise<{ | |
plugins: Plugin[]; | |
stateLines: string[]; | |
}> { | |
args.contextBuilder.setGlobal({ | |
protocols: ["git"], | |
}); | |
const [context, options] = await args.contextBuilder.get(args.denops); | |
const dotfilesDir = '~/dotfiles'; | |
const normalPlugins = await args.dpp.extAction( | |
args.denops, | |
context, | |
options, | |
"toml", | |
"load", | |
{ | |
path: await fn.expand(args.denops, dotfilesDir + "/dein.toml"), | |
options: { }, | |
}, | |
) as Plugin[]; | |
const lazyPlugins = await args.dpp.extAction( | |
args.denops, | |
context, | |
options, | |
"toml", | |
"load", | |
{ | |
path: await fn.expand(args.denops, dotfilesDir + "/dein_lazy.toml"), | |
options: { | |
lazy: true, | |
}, | |
}, | |
) as Plugin[]; | |
const dduPlugins = await args.dpp.extAction( | |
args.denops, | |
context, | |
options, | |
"toml", | |
"load", | |
{ | |
path: await fn.expand(args.denops, dotfilesDir + "/dein_ddu.toml"), | |
options: { | |
lazy: true, | |
}, | |
}, | |
) as Plugin[]; | |
const ddcPlugins = await args.dpp.extAction( | |
args.denops, | |
context, | |
options, | |
"toml", | |
"load", | |
{ | |
path: await fn.expand(args.denops, dotfilesDir + "/dein_ddc.toml"), | |
options: { | |
lazy: true, | |
}, | |
}, | |
) as Plugin[]; | |
const recordPlugins: Record<string, Plugin> = {}; | |
for (const plugin of normalPlugins) { | |
recordPlugins[plugin.name] = plugin; | |
} | |
for (const plugin of lazyPlugins) { | |
recordPlugins[plugin.name] = plugin; | |
} | |
for (const plugin of dduPlugins) { | |
recordPlugins[plugin.name] = plugin; | |
} | |
for (const plugin of ddcPlugins) { | |
recordPlugins[plugin.name] = plugin; | |
} | |
const stateLines = await args.dpp.extAction( | |
args.denops, | |
context, | |
options, | |
"lazy", | |
"makeState", | |
{ | |
plugins: Object.values(recordPlugins), | |
}, | |
) as string[]; | |
return { | |
plugins: Object.values(recordPlugins), | |
stateLines, | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment