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

Add toml config documentation (#1721)

* Fix toml config example

ref #1705
close #1705 
close #1704 
close #1701 
close #1629
This commit is contained in:
Wang Shidong 2018-05-13 12:59:41 +08:00 committed by GitHub
parent 2d2365619c
commit 92733364e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 55 additions and 52 deletions

View File

@ -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

View File

@ -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

View File

@ -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`.

View File

@ -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.
<!-- vim-markdown-toc GFM -->
- [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.
<!-- vim-markdown-toc -->
### 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.

View File

@ -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

View File

@ -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

View File

@ -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