1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:40:05 +08:00

Enable test layer configuration (#2669)

* Enable test layer configuration

* test layer settings separator changed from - to _
This commit is contained in:
Alessio Linares 2019-04-02 15:07:25 +02:00 committed by Wang Shidong
parent afbd54a538
commit a3342e0dbe
2 changed files with 31 additions and 0 deletions

View File

@ -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

View File

@ -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 |