diff --git a/autoload/SpaceVim/layers/lang/zig.vim b/autoload/SpaceVim/layers/lang/zig.vim index b27322228..92374584c 100644 --- a/autoload/SpaceVim/layers/lang/zig.vim +++ b/autoload/SpaceVim/layers/lang/zig.vim @@ -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 diff --git a/docs/layers/lang/zig.md b/docs/layers/lang/zig.md index 34852e9b3..7ab013976 100644 --- a/docs/layers/lang/zig.md +++ b/docs/layers/lang/zig.md @@ -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.