1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 00:20:05 +08:00

Add doc for custom spc func (#4472)

This commit is contained in:
Wang Shidong 2021-09-19 17:54:17 +08:00 committed by GitHub
parent 68e123447a
commit 7e33b5e39b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 0 deletions

View File

@ -83,6 +83,13 @@ function! s:write_to_config(config) abort
call writefile(a:config, cf, '')
endfunction
""
" The first parameter sets the type of shortcut key,
" which can be `nnoremap` or `nmap`, the second parameter is a list of keys,
" and the third parameter is an ex command or key binding,
" depending on whether the last parameter is true.
" The fourth parameter is a short description of this custom key binding.
function! SpaceVim#custom#SPC(m, keys, cmd, desc, is_cmd) abort
call add(g:_spacevim_mappings_space_custom,[a:m, a:keys, a:cmd, a:desc, a:is_cmd])
endfunction

View File

@ -1382,6 +1382,14 @@ SpaceVim#api#import({name}) *SpaceVim#api#import()*
Import API base the given {name}, and return the API object. for all
available APIs please check |spacevim-api|
SpaceVim#custom#SPC({m}, {keys}, {cmd}, {desc}, {is_cmd})
*SpaceVim#custom#SPC()*
The first parameter sets the type of shortcut key, which can be `nnoremap`
or `nmap`, the second parameter is a list of keys, and the third parameter
is an ex command or key binding, depending on whether the last parameter is
true. The fourth parameter is a short description of this custom key
binding.
SpaceVim#layers#load({layer}) *SpaceVim#layers#load()*
Load the {layer} you want. For all the layers SpaceVim supports, see
|SpaceVim-layers|. the second argv is the layer variable.

View File

@ -926,6 +926,10 @@ endfunction
call SpaceVim#custom#SPC('nnoremap', ['f', 't'], 'echom "hello world"', 'test custom SPC', 1)
```
第一个参数设定快捷键的类型,
可以是 `nnoremap` 或者 `nmap`,第二个参数是一个按键列表,
第三个参数是一个 ex 命令或者按键,这基于最后一个参数是否为`true`。第四个参数是一个简短的描述。
**模糊搜索快捷键**
可以通过 `SPC ?` 将当前快捷键罗列出来。然后可以输入快捷键按键字母或者描述,可以模糊匹配并展示结果。

View File

@ -1002,6 +1002,12 @@ Use `SpaceVim#custom#SPC()` to define custom SPC mappings. For instance:
call SpaceVim#custom#SPC('nnoremap', ['f', 't'], 'echom "hello world"', 'test custom SPC', 1)
```
The first parameter sets the type of shortcut key,
which can be `nnoremap` or `nmap`, the second parameter is a list of keys,
and the third parameter is an ex command or key binding,
depending on whether the last parameter is true.
The fourth parameter is a short description of this custom key binding.
**Fuzzy find key bindings**
It is possible to search for specific key bindings by pressing `?` in the root of the guide buffer.