From a3342e0dbed5930406db2038dca0c58181e649b2 Mon Sep 17 00:00:00 2001 From: Alessio Linares Date: Tue, 2 Apr 2019 15:07:25 +0200 Subject: [PATCH] Enable test layer configuration (#2669) * Enable test layer configuration * test layer settings separator changed from - to _ --- autoload/SpaceVim/layers/test.vim | 10 ++++++++++ docs/layers/test.md | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/autoload/SpaceVim/layers/test.vim b/autoload/SpaceVim/layers/test.vim index 72020a3a6..3e1c042cc 100644 --- a/autoload/SpaceVim/layers/test.vim +++ b/autoload/SpaceVim/layers/test.vim @@ -39,3 +39,13 @@ function! SpaceVim#layers#test#config() abort let g:test#custom_strategies = {'spacevim': function('SpaceVim#plugins#runner#open')} let g:test#strategy = 'spacevim' endfunction + +function! SpaceVim#layers#test#set_variable(var) abort + let l:override = get(a:var, 'override_config', {}) + if !empty(l:override) + for l:option in keys(l:override) + let l:varname = 'test#'.substitute(l:option, '_', '#', 'g') + execute 'let g:'.l:varname.' = '."'".l:override[l:option]."'" + endfor + endif +endfunction diff --git a/docs/layers/test.md b/docs/layers/test.md index 726cb5074..940e3ba63 100644 --- a/docs/layers/test.md +++ b/docs/layers/test.md @@ -26,6 +26,27 @@ To use this configuration layer, add following snippet to your custom configurat name = "test" ``` +## Configuration + +To set or override any configuration ([see supported settings here](https://github.com/janko/vim-test)) you may use the `override_config`: + +```toml +[[layers]] + name = "test" + [layers.override_config] + java_runner = "gradletest" + java_gradletest_executable = "./gradlew test" +``` + +In the example above is equivalent to adding the following in viml: + +```viml +let test#java#runner = "gradletest" +let test#java#gradletest#executable = "./gradlew test" +``` + +In essence, it replaces `_` with `#` and prepends `test#` to the keys inside `override_config`. + ## Key bindings | Key Binding | Description |