1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:40:06 +08:00

doc(core): add :h SpaceVim-options-bootstrap_after/before

Problem: there isn't doc about boostrap function.
Solution:
1. add `:h SpaceVim-options-bootstrap_before`
2. and `:h SpaceVim-options-bootstrap_after`
3. update cn documentation about the differences between
   bootstrap_after and bootstrap_before function.
This commit is contained in:
Shidong Wang 2021-10-01 18:49:22 +08:00
parent 7de44bde74
commit 3a68e6ad21
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
3 changed files with 105 additions and 58 deletions

View File

@ -162,7 +162,29 @@ function! SpaceVim#custom#apply(config, type) abort
call SpaceVim#logger#info(string(plugin))
endif
endfor
""
" @section bootstrap_before, options-bootstrap_before
" @parentsection options
" set the bootstrap_before function, this function will be called when
" loading custom configuration file. for example:
" >
" [options]
" bootstrap_before = 'myspacevim#before'
" <
let bootstrap_before = get(options, 'bootstrap_before', '')
""
" @section bootstrap_after, options-bootstrap_after
" @parentsection options
" set the bootstrap_after function, this function will be called on
" `VimEnter` event.
" >
" [options]
" bootstrap_after = 'myspacevim#after'
" <
let g:_spacevim_bootstrap_after = get(options, 'bootstrap_after', '')
if !empty(bootstrap_before)
try

View File

@ -20,64 +20,66 @@ CONTENTS *SpaceVim-contents*
2. Options................................................|SpaceVim-options|
1. autocomplete_method............|SpaceVim-options-autocomplete_method|
2. autocomplete_parens............|SpaceVim-options-autocomplete_parens|
3. buffer_index_type................|SpaceVim-options-buffer_index_type|
4. checkinstall..........................|SpaceVim-options-checkinstall|
5. code_runner_focus................|SpaceVim-options-code_runner_focus|
6. colorscheme............................|SpaceVim-options-colorscheme|
7. colorscheme_bg......................|SpaceVim-options-colorscheme_bg|
8. data_dir..................................|SpaceVim-options-data_dir|
9. default_custom_leader........|SpaceVim-options-default_custom_leader|
10. default_indent.....................|SpaceVim-options-default_indent|
11. enable_bepo_layout.............|SpaceVim-options-enable_bepo_layout|
12. enable_cursorcolumn...........|SpaceVim-options-enable_cursorcolumn|
13. enable_cursorline...............|SpaceVim-options-enable_cursorline|
14. enable_debug.........................|SpaceVim-options-enable_debug|
15. enable_googlesuggest.........|SpaceVim-options-enable_googlesuggest|
16. enable_guicolors.................|SpaceVim-options-enable_guicolors|
17. enable_key_frequency.........|SpaceVim-options-enable_key_frequency|
18. enable_projects_cache.......|SpaceVim-options-enable_projects_cache|
19. enable_statusline_bfpath.|SpaceVim-options-enable_statusline_bfpath|
20. enable_statusline_mode.....|SpaceVim-options-enable_statusline_mode|
21. enable_statusline_tag.......|SpaceVim-options-enable_statusline_tag|
22. enable_tabline_ft_icon.....|SpaceVim-options-enable_tabline_ft_icon|
23. enable_vimfiler_welcome...|SpaceVim-options-enable_vimfiler_welcome|
24. enable_ycm.............................|SpaceVim-options-enable_ycm|
25. error_symbol.........................|SpaceVim-options-error_symbol|
26. escape_key_binding.............|SpaceVim-options-escape_key_binding|
27. file_searching_tools.........|SpaceVim-options-file_searching_tools|
28. filemanager...........................|SpaceVim-options-filemanager|
29. filetree_direction.............|SpaceVim-options-filetree_direction|
30. guifont...................................|SpaceVim-options-guifont|
31. home_files_number...............|SpaceVim-options-home_files_number|
32. info_symbol...........................|SpaceVim-options-info_symbol|
33. keep_server_alive...............|SpaceVim-options-keep_server_alive|
34. language.................................|SpaceVim-options-language|
35. lint_engine...........................|SpaceVim-options-lint_engine|
36. lint_on_the_fly...................|SpaceVim-options-lint_on_the_fly|
37. max_column.............................|SpaceVim-options-max_column|
38. plugin_bundle_dir...............|SpaceVim-options-plugin_bundle_dir|
39. plugin_manager_processes.|SpaceVim-options-plugin_manager_processes|
40. project_auto_root...............|SpaceVim-options-project_auto_root|
41. project_rooter_outermost.|SpaceVim-options-project_rooter_outermost|
42. project_rooter_patterns...|SpaceVim-options-project_rooter_patterns|
43. projects_cache_num.............|SpaceVim-options-projects_cache_num|
44. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide|
45. relativenumber.....................|SpaceVim-options-relativenumber|
46. retry_cnt...............................|SpaceVim-options-retry_cnt|
47. search_tools.........................|SpaceVim-options-search_tools|
48. sidebar_width.......................|SpaceVim-options-sidebar_width|
49. snippet_engine.....................|SpaceVim-options-snippet_engine|
50. statusline_iseparator.......|SpaceVim-options-statusline_iseparator|
51. statusline_left_sections.|SpaceVim-options-statusline_left_sections|
52. statusline_separator.........|SpaceVim-options-statusline_separator|
53. statusline_unicode.............|SpaceVim-options-statusline_unicode|
54. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape|
55. vim_help_language...............|SpaceVim-options-vim_help_language|
56. vimcompatible.......................|SpaceVim-options-vimcompatible|
57. warning_symbol.....................|SpaceVim-options-warning_symbol|
58. windows_index_type.............|SpaceVim-options-windows_index_type|
59. windows_leader.....................|SpaceVim-options-windows_leader|
60. windows_smartclose.............|SpaceVim-options-windows_smartclose|
3. bootstrap_after....................|SpaceVim-options-bootstrap_after|
4. bootstrap_before..................|SpaceVim-options-bootstrap_before|
5. buffer_index_type................|SpaceVim-options-buffer_index_type|
6. checkinstall..........................|SpaceVim-options-checkinstall|
7. code_runner_focus................|SpaceVim-options-code_runner_focus|
8. colorscheme............................|SpaceVim-options-colorscheme|
9. colorscheme_bg......................|SpaceVim-options-colorscheme_bg|
10. data_dir.................................|SpaceVim-options-data_dir|
11. default_custom_leader.......|SpaceVim-options-default_custom_leader|
12. default_indent.....................|SpaceVim-options-default_indent|
13. enable_bepo_layout.............|SpaceVim-options-enable_bepo_layout|
14. enable_cursorcolumn...........|SpaceVim-options-enable_cursorcolumn|
15. enable_cursorline...............|SpaceVim-options-enable_cursorline|
16. enable_debug.........................|SpaceVim-options-enable_debug|
17. enable_googlesuggest.........|SpaceVim-options-enable_googlesuggest|
18. enable_guicolors.................|SpaceVim-options-enable_guicolors|
19. enable_key_frequency.........|SpaceVim-options-enable_key_frequency|
20. enable_projects_cache.......|SpaceVim-options-enable_projects_cache|
21. enable_statusline_bfpath.|SpaceVim-options-enable_statusline_bfpath|
22. enable_statusline_mode.....|SpaceVim-options-enable_statusline_mode|
23. enable_statusline_tag.......|SpaceVim-options-enable_statusline_tag|
24. enable_tabline_ft_icon.....|SpaceVim-options-enable_tabline_ft_icon|
25. enable_vimfiler_welcome...|SpaceVim-options-enable_vimfiler_welcome|
26. enable_ycm.............................|SpaceVim-options-enable_ycm|
27. error_symbol.........................|SpaceVim-options-error_symbol|
28. escape_key_binding.............|SpaceVim-options-escape_key_binding|
29. file_searching_tools.........|SpaceVim-options-file_searching_tools|
30. filemanager...........................|SpaceVim-options-filemanager|
31. filetree_direction.............|SpaceVim-options-filetree_direction|
32. guifont...................................|SpaceVim-options-guifont|
33. home_files_number...............|SpaceVim-options-home_files_number|
34. info_symbol...........................|SpaceVim-options-info_symbol|
35. keep_server_alive...............|SpaceVim-options-keep_server_alive|
36. language.................................|SpaceVim-options-language|
37. lint_engine...........................|SpaceVim-options-lint_engine|
38. lint_on_the_fly...................|SpaceVim-options-lint_on_the_fly|
39. max_column.............................|SpaceVim-options-max_column|
40. plugin_bundle_dir...............|SpaceVim-options-plugin_bundle_dir|
41. plugin_manager_processes.|SpaceVim-options-plugin_manager_processes|
42. project_auto_root...............|SpaceVim-options-project_auto_root|
43. project_rooter_outermost.|SpaceVim-options-project_rooter_outermost|
44. project_rooter_patterns...|SpaceVim-options-project_rooter_patterns|
45. projects_cache_num.............|SpaceVim-options-projects_cache_num|
46. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide|
47. relativenumber.....................|SpaceVim-options-relativenumber|
48. retry_cnt...............................|SpaceVim-options-retry_cnt|
49. search_tools.........................|SpaceVim-options-search_tools|
50. sidebar_width.......................|SpaceVim-options-sidebar_width|
51. snippet_engine.....................|SpaceVim-options-snippet_engine|
52. statusline_iseparator.......|SpaceVim-options-statusline_iseparator|
53. statusline_left_sections.|SpaceVim-options-statusline_left_sections|
54. statusline_separator.........|SpaceVim-options-statusline_separator|
55. statusline_unicode.............|SpaceVim-options-statusline_unicode|
56. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape|
57. vim_help_language...............|SpaceVim-options-vim_help_language|
58. vimcompatible.......................|SpaceVim-options-vimcompatible|
59. warning_symbol.....................|SpaceVim-options-warning_symbol|
60. windows_index_type.............|SpaceVim-options-windows_index_type|
61. windows_leader.....................|SpaceVim-options-windows_leader|
62. windows_smartclose.............|SpaceVim-options-windows_smartclose|
3. Configuration...........................................|SpaceVim-config|
4. Commands..............................................|SpaceVim-commands|
5. Functions............................................|SpaceVim-functions|
@ -271,6 +273,26 @@ Enable/Disable autocompletion of parentheses, default is true (enabled).
autocomplete_parens = false
<
==============================================================================
BOOTSTRAP_AFTER *SpaceVim-options-bootstrap_after*
set the bootstrap_after function, this function will be called on `VimEnter`
event.
>
[options]
bootstrap_after = 'myspacevim#after'
<
==============================================================================
BOOTSTRAP_BEFORE *SpaceVim-options-bootstrap_before*
set the bootstrap_before function, this function will be called when loading
custom configuration file. for example:
>
[options]
bootstrap_before = 'myspacevim#before'
<
==============================================================================
BUFFER_INDEX_TYPE *SpaceVim-options-buffer_index_type*

View File

@ -309,6 +309,9 @@ SpaceVim 默认安装了一些插件,如果需要禁用某个插件,可以
bootstrap_after = "myspacevim#after"
```
这两种启动函数的区别在于,`bootstrap_before`函数是在载入用户配置时候执行的,
而`bootstrap_after`函数是在触发`VimEnter`事件时执行的。
启动函数文件应放置在 Vim &runtimepath 的 autoload 文件夹内。例如:
文件名:`~/.SpaceVim.d/autoload/myspacevim.vim`