1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:50:06 +08:00

Add test command in zig language plugin (#3970)

This commit is contained in:
AdamGoertz 2020-11-20 10:16:41 -05:00 committed by GitHub
parent 3d525cb8c4
commit a9e36e0e1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -19,6 +19,7 @@ endfunction
function! SpaceVim#layers#lang#zig#config() abort
call SpaceVim#plugins#runner#reg_runner('zig', 'zig run %s')
call SpaceVim#plugins#runner#reg_runner('zig', 'zig test %s')
call SpaceVim#mapping#space#regesit_lang_mappings('zig', function('s:language_specified_mappings'))
if executable(s:ztagsbin) && !exists('g:tagbar_type_zig')
let g:tagbar_type_zig = {
@ -53,6 +54,7 @@ endfunction
function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','t'], 'call SpaceVim#plugins#runner#open()', 'test current file', 1)
endfunction
function! SpaceVim#layers#lang#zig#set_variable(opt) abort

View File

@ -34,6 +34,16 @@ To use this configuration layer, update custom configuration file with:
## Key bindings
### Running current script
### Run current file
| Mode | Key Bindings | Description |
| ------ | ------------ | ------------------------------ |
| normal | `SPC l r` | build and run the current file |
### Test current file
| Mode | Key Bindings | Description |
| ------ | ------------ | ------------------------------ |
| normal | `SPC l t` | run all tests in current file |
To running a zig file, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer.