From 8c3d1d828116876eee2834fc93664770326958ec Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 19 Jul 2020 10:47:58 +0800 Subject: [PATCH] Fix dein support (#3647) close #3513 --- autoload/SpaceVim.vim | 2 +- autoload/SpaceVim/custom.vim | 14 +++++++++++++- doc/SpaceVim.txt | 2 +- docs/cn/documentation.md | 4 ++-- docs/cn/layers/colorscheme.md | 2 +- docs/cn/quick-start-guide.md | 2 +- docs/documentation.md | 15 ++++++++------- docs/layers/colorscheme.md | 2 +- docs/quick-start-guide.md | 2 +- 9 files changed, 29 insertions(+), 16 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 16688680b..52cac379b 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -972,7 +972,7 @@ let g:spacevim_disabled_plugins = [] " Add custom plugins. " > " [[custom_plugins]] -" name = 'vimwiki/vimwiki' +" repo = 'vimwiki/vimwiki' " merged = false " < diff --git a/autoload/SpaceVim/custom.vim b/autoload/SpaceVim/custom.vim index ba12bca28..6dfe1e937 100644 --- a/autoload/SpaceVim/custom.vim +++ b/autoload/SpaceVim/custom.vim @@ -114,7 +114,19 @@ function! SpaceVim#custom#apply(config, type) abort endfor let custom_plugins = get(a:config, 'custom_plugins', []) for plugin in custom_plugins - call add(g:spacevim_custom_plugins, [plugin.name, plugin]) + " name is an option for dein, we need to use repo instead + " but we also need to keep backward compatible! + " this the first argv should be get(plugin, 'repo', get(plugin, 'name', + " '')) + " BTW, we also need to check if the plugin has name or repo key + if has_key(plugin, 'name') + call add(g:spacevim_custom_plugins, [plugin.name, plugin]) + elseif has_key(plugin, 'repo') + call add(g:spacevim_custom_plugins, [plugin.repo, plugin]) + else + call SpaceVim#logger#warn('custom_plugins should contains repo key!') + call SpaceVim#logger#info(string(plugin)) + endif endfor let bootstrap_before = get(options, 'bootstrap_before', '') let g:_spacevim_bootstrap_after = get(options, 'bootstrap_after', '') diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index baa94e0c0..5972f291f 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -3181,7 +3181,7 @@ CUSTOM_PLUGINS *SpaceVim-usage-custom_plugins* Add custom plugins. > [[custom_plugins]] - name = 'vimwiki/vimwiki' + repo = 'vimwiki/vimwiki' merged = false < diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 911518d75..9ae9f23c4 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -235,7 +235,7 @@ SpaceVim 根据需要定义了很多临时快捷键,这可以避免需要重 ```toml [[custom_plugins]] - name = "lilydjwg/colorizer" + repo = "lilydjwg/colorizer" on_cmd = ["ColorHighlight", "ColorToggle"] merged = false ``` @@ -368,7 +368,7 @@ SpaceVim 的[模块首页](../layers/)。 ```toml [[custom_plugins]] - name = 'wsdjeg/neomake.vim' + repo = 'wsdjeg/neomake.vim' # note: you need to disable merged feature merged = false ``` diff --git a/docs/cn/layers/colorscheme.md b/docs/cn/layers/colorscheme.md index a2a1f7224..62d4bdd0e 100644 --- a/docs/cn/layers/colorscheme.md +++ b/docs/cn/layers/colorscheme.md @@ -64,7 +64,7 @@ colorscheme 模块为 SpaceVim 提供了一系列常用的颜色主题,默认 # 添加自定义主题:https://github.com/mhartington/oceanic-next [[custom_plugins]] - name = "mhartington/oceanic-next" + repo = "mhartington/oceanic-next" merged = 0 ``` diff --git a/docs/cn/quick-start-guide.md b/docs/cn/quick-start-guide.md index 25d30eb18..e028af07a 100644 --- a/docs/cn/quick-start-guide.md +++ b/docs/cn/quick-start-guide.md @@ -120,7 +120,7 @@ SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单 # 添加自定义插件 [[custom_plugins]] - name = "lilydjwg/colorizer" + repo = "lilydjwg/colorizer" merged = false ``` diff --git a/docs/documentation.md b/docs/documentation.md index f96cd1960..d592f0cfe 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -244,9 +244,9 @@ If you want to add plugins from github, just add the repo name to the `custom_pl ```toml [[custom_plugins]] -name = "lilydjwg/colorizer" -on_cmd = ["ColorHighlight", "ColorToggle"] -merged = false + repo = "lilydjwg/colorizer" + on_cmd = ["ColorHighlight", "ColorToggle"] + merged = false ``` `on_cmd` option means this plugin will be loaded only when the following commands are called. For more options see `:h dein-options`. @@ -258,7 +258,7 @@ If you want to disable plugins which are added by SpaceVim, you can use SpaceVim ```toml [options] # NOTE: the value should be a list, and each item is the name of the plugin. -disabled_plugins = ["clighter", "clighter8"] + disabled_plugins = ["clighter", "clighter8"] ``` ### Bootstrap Functions @@ -326,6 +326,7 @@ The different key bindings between SpaceVim and origin vim are shown as below. ``` - The `jk` key has been mapped to `` in insert mode. To disable this key binding, set `escape_key_binding` to empty string. + ```toml [options] escape_key_binding = '' @@ -381,9 +382,9 @@ disabled_plugins = ["neomake.vim"] ```toml [[custom_plugins]] -name = "wsdjeg/neomake.vim" -# note: you need to disable merged feature -merged = false + repo = "wsdjeg/neomake.vim" + # note: you need to disable merged feature + merged = false ``` Use the `bootstrap_before` function to add local plugin: diff --git a/docs/layers/colorscheme.md b/docs/layers/colorscheme.md index 2812b92c5..8e77a48a2 100644 --- a/docs/layers/colorscheme.md +++ b/docs/layers/colorscheme.md @@ -64,7 +64,7 @@ are available on Github, use the `custom_plugins` section in configuration file. # add custom_plugins: https://github.com/mhartington/oceanic-next [[custom_plugins]] - name = "mhartington/oceanic-next" + repo = "mhartington/oceanic-next" merged = 0 ``` diff --git a/docs/quick-start-guide.md b/docs/quick-start-guide.md index 9c475f650..0e51b8997 100644 --- a/docs/quick-start-guide.md +++ b/docs/quick-start-guide.md @@ -107,7 +107,7 @@ documentation. # This is an example for adding custom plugins lilydjwg/colorizer [[custom_plugins]] - name = "lilydjwg/colorizer" + repo = "lilydjwg/colorizer" merged = false ```