diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index 4af1c8f80..e5b3a1b78 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -148,6 +148,13 @@ function! SpaceVim#autocmds#VimEnter() abort set showtabline=2 endif call SpaceVim#plugins#projectmanager#RootchandgeCallback() + if !empty(get(g:, '_spacevim_bootstrap_after', '')) + try + call call(g:_spacevim_bootstrap_after, []) + catch + call SpaceVim#logger#error('failed to call bootstrap_after function: ' . g:_spacevim_bootstrap_after) + endtry + endif endfunction function! s:disable_welcome() abort diff --git a/autoload/SpaceVim/custom.vim b/autoload/SpaceVim/custom.vim index 733d65fd4..a8e661ce1 100644 --- a/autoload/SpaceVim/custom.vim +++ b/autoload/SpaceVim/custom.vim @@ -86,10 +86,23 @@ function! SpaceVim#custom#apply(config) abort for [name, value] in items(options) exe 'let g:spacevim_' . name . ' = value' endfor - let layers = get(a:config, 'layers', {}) + let layers = get(a:config, 'layers', []) for layer in layers - call SpaceVim#layers#load(layer.name, layer) + if !get(layer, 'enable', 1) + call SpaceVim#layers#disable(layer.name) + else + call SpaceVim#layers#load(layer.name, layer) + endif endfor + let bootstrap_before = get(options, 'bootstrap_before', '') + let g:_spacevim_bootstrap_after = get(options, 'bootstrap_after', '') + if !empty(bootstrap_before) + try + call call(bootstrap_before, []) + catch + call SpaceVim#logger#error('failed to call bootstrap_before function: ' . bootstrap_before) + endtry + endif endif endfunction diff --git a/docs/documentation.md b/docs/documentation.md index 42d1d8fae..5a2ad9658 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -16,8 +16,6 @@ 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) - - [Automatic Generation](#automatic-generation) - - [Alternative directory](#alternative-directory) - [Vim Compatible Mode](#vim-compatible-mode) - [Private Layers](#private-layers) - [Concepts](#concepts) @@ -190,15 +188,11 @@ Use `:SPDebugInfo!` command will display the log of SpaceVim. You also can use ` ## Custom Configuration -### Automatic Generation +The very first time SpaceVim starts up, it will ask you to choose a mode, +then create the `SpaceVim.d/init.toml` in your `HOME` directory. All User +configuration can be stored in your `~/.SpaceVim.d` directory. -The very first time SpaceVim starts up, it will ask you several questions and then create the `SpaceVim.d/init.toml` in your `HOME` directory. - -### Alternative directory - -User configuration can be stored in your `~/.SpaceVim.d` directory. - -`~/.SpaceVim.d/` will be added to `&runtimepath` of vim. read `:h rtp`. +`~/.SpaceVim.d/` will be added to `&runtimepath` of vim. It is also possible to override the location of `~/.SpaceVim.d/` using the environment variable `SPACEVIMDIR`. Of course you can also use symlinks to change the location of @@ -207,30 +201,8 @@ this directory. SpaceVim also support local config file for project, the init file is `.SpaceVim.d/init.toml` in the root of your project. `.SpaceVim.d/` will also be added into runtimepath. -here is an example config file for SpaceVim: - -```toml -# This is basic configuration example for SpaceVim - -[option] - colorscheme = "gruvbox" - background = "dark" - guicolors = true - statusline_separator = "nil" - statusline_separator = "bar" - buffer_index_type = 4 - filetype_icon = false - statusline_display_mode = false - -[[layers]] - [checkers] - [shell] - default_position = "top" - default_height = 30 - [lang/java] -``` - -This is a list of available options for SpaceVim: +All SpaceVim options can be found in `:h SpaceVim-config`, the key is same as +the option name(just remove `g:spacevim_` prefix). Comprehensive documentation is available for each layer by `:h SpaceVim`. diff --git a/docs/faq.md b/docs/faq.md index 817e27f2b..04ad02675 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -7,7 +7,6 @@ description: "A list of questions and answers relating to SpaceVim, especially o this is a list of most asked questions about SpaceVim. - - [Where should I put my configuration?](#where-should-i-put-my-configuration) @@ -17,12 +16,12 @@ this is a list of most asked questions about SpaceVim. -### Where should I put my configuration? +## Where should I put my configuration? -SpaceVim load custom global configuration from `~/.SpaceVim.d/init.vim`. It also support project specific configuration, -That means it will load `.SpaceVim.d/init.vim` from the root of your project. +SpaceVim load custom global configuration from `~/.SpaceVim.d/init.toml`. It also support project specific configuration, +That means it will load `.SpaceVim.d/init.toml` from the root of your project. -### E492: Not an editor command: ^M +## E492: Not an editor command: ^M The problem was git auto added ^M when cloning, solved by: @@ -30,11 +29,14 @@ The problem was git auto added ^M when cloning, solved by: git config --global core.autocrlf input ``` -### Why SpaceVim can not display default colorscheme? +## Why SpaceVim can not display default colorscheme? By default, SpaceVim use true colors, so you should make sure your terminal support true colors, This is an articl about what is true colors and the terminals which support true colors. -### Why I can not update plugins? +## Why I can not update plugins? -Sometimes you will see `Updating failed, The plugin dir is dirty`. Since the dir of a plugin is a git repo, if the directory is dirty, you can not use `git pull` to update plugin. To fix this issue, just move your cursor to the error line, and press `gf`, then run `git reset --hard HEAD` or `git checkout .`. for more info, please read documentation of git. +Sometimes you will see `Updating failed, The plugin dir is dirty`. Since the dir of a plugin is a git repo, if the +directory is dirty, you can not use `git pull` to update plugin. To fix this issue, just move your cursor to the +error line, and press `gf`, then run `git reset --hard HEAD` or `git checkout .`. for more info, please read +documentation of git. diff --git a/docs/quick-start-guide.md b/docs/quick-start-guide.md index 5561bed05..9aae5d117 100644 --- a/docs/quick-start-guide.md +++ b/docs/quick-start-guide.md @@ -46,7 +46,9 @@ The easiest way is to download [install.cmd](https://spacevim.org/install.cmd) a ## Configuration -The default configuration file of SpaceVim is `~/.SpaceVim.d/init.toml`, here is an example: +The default configuration file of SpaceVim is `~/.SpaceVim.d/init.toml`. This is +an example for basic usage of SpaceVim. For more info, please checkout SpaceVim +documentation. ```toml # This is basic configuration example for SpaceVim @@ -55,18 +57,22 @@ The default configuration file of SpaceVim is `~/.SpaceVim.d/init.toml`, here is [options] # set spacevim theme. by default colorscheme layer is not loaded, # if you want to use more colorscheme, please load the colorscheme - # layer + # layer, the value of this option is a string. colorscheme = "gruvbox" background = "dark" # Disable guicolors in basic mode, many terminal do not support 24bit - # true colors + # true colors, the type of the value is boolean, true or false. guicolors = true # Disable statusline separator, if you want to use other value, please # install nerd fonts statusline_separator = "nil" statusline_separator = "bar" buffer_index_type = 4 - filetype_icon = false + # Display file type icon on the tabline, If you do not have nerd fonts installed, + # please change the value to false + enable_tabline_filetype_icon = true + # Display current mode text on statusline, by default It is disabled, only color + # will be changed when switch modes. statusline_display_mode = false # Enable autocomplete layer @@ -79,9 +85,12 @@ auto-completion-tab-key-behavior = "cycle" name = "shell" default_position = "top" default_height = 30 -``` -This example only list part of SpaceVim options, for the list of SpaceVim options, please read `:h SpaceVim-config` +# This is an example for adding custom plugins lilydjwg/colorizer +[[custom_plugins]] +neme = 'lilydjwg/colorizer' +merged = 0 +``` ## Learning SpaceVim diff --git a/mode/basic.toml b/mode/basic.toml index e3b7e3362..059fbffb3 100644 --- a/mode/basic.toml +++ b/mode/basic.toml @@ -21,7 +21,7 @@ statusline_separator = "nil" statusline_inactive_separator = "bar" buffer_index_type = 4 - filetype_icon = false + enable_tabline_filetype_icon = false statusline_display_mode = false # Enable vim compatible mode, avoid changing origin vim key bindings vimcompatible = 1 diff --git a/mode/dark_powered.toml b/mode/dark_powered.toml index f0aa9e0dd..31d44d4a8 100644 --- a/mode/dark_powered.toml +++ b/mode/dark_powered.toml @@ -21,7 +21,7 @@ statusline_separator = "arrow" statusline_inactive_separator = "arrow" buffer_index_type = 4 - filetype_icon = true + enable_tabline_filetype_icon = true statusline_display_mode = false # Enable autocomplete layer