From 80da489f77382c28fd39b8c9c1c66c422f3da436 Mon Sep 17 00:00:00 2001 From: xiayyu Date: Fri, 1 Jun 2018 12:55:09 +0800 Subject: [PATCH] add useage of bootstrap function to docs (#1771) --- docs/documentation.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/documentation.md b/docs/documentation.md index 19003f8ca..be69b1744 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -16,6 +16,7 @@ description: "General documentation about how to using SpaceVim, including the q - [Update plugins](#update-plugins) - [Get SpaceVim log](#get-spacevim-log) - [Custom Configuration](#custom-configuration) + - [Bootstrap Functions](#bootstrap-functions) - [Vim Compatible Mode](#vim-compatible-mode) - [Private Layers](#private-layers) - [Concepts](#concepts) @@ -212,6 +213,23 @@ call SpaceVim#custom#SPCGroupName(['G'], '+TestGroup') 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 +endf + +func! myspacevim#after() abort + iunmap jk +endf +``` + ### 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.