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

add useage of bootstrap function to docs (#1771)

This commit is contained in:
xiayyu 2018-06-01 12:55:09 +08:00
parent 7c07f62c76
commit 80da489f77

View File

@ -16,6 +16,7 @@ description: "General documentation about how to using SpaceVim, including the q
- [Update plugins](#update-plugins) - [Update plugins](#update-plugins)
- [Get SpaceVim log](#get-spacevim-log) - [Get SpaceVim log](#get-spacevim-log)
- [Custom Configuration](#custom-configuration) - [Custom Configuration](#custom-configuration)
- [Bootstrap Functions](#bootstrap-functions)
- [Vim Compatible Mode](#vim-compatible-mode) - [Vim Compatible Mode](#vim-compatible-mode)
- [Private Layers](#private-layers) - [Private Layers](#private-layers)
- [Concepts](#concepts) - [Concepts](#concepts)
@ -212,6 +213,23 @@ call SpaceVim#custom#SPCGroupName(['G'], '+TestGroup')
call SpaceVim#custom#SPC('nore', ['G', 't'], 'echom 1', 'echomessage 1', 1) call SpaceVim#custom#SPC('nore', ['G', 't'], 'echom 1', 'echomessage 1', 1)
``` ```
### Bootstrap Functions
SpaceVim provides two kinds of bootstrap functions for custom configurations and key bindings, namely `bootstrap_before` and `bootstrap_after`. To enable it you need to add `bootstrap_before = "myspacevim#before"` or `bootstrap_after = "myspacevim#after"` to `[options]` section in file `.SpaceVim.d/init.toml`. The difference is that these two functions will be called before or after the loading of SpaceVim's main scripts as they named.
The bootstrap functions should be placed to the `autoload` directory in `runtimepath`, please refer to `:h autoload-functions` for further instructions. In our case, create file `.SpaceVim.d/autoload/myspacevim.vim` with contents for exmaple
```vim
func! myspacevim#before() abort
let g:neomake_enabled_c_makers = ['clang']
nnoremap jk <esc>
endf
func! myspacevim#after() abort
iunmap jk
endf
```
### Vim Compatible Mode ### Vim Compatible Mode
This a list of different key bindings between SpaceVim and origin vim. If you still want to use this origin function, you can enable vimcompatible mode, via `vimcompatible = true` in `[options]` section. This a list of different key bindings between SpaceVim and origin vim. If you still want to use this origin function, you can enable vimcompatible mode, via `vimcompatible = true` in `[options]` section.