1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 15:19:12 +08:00

Merge pull request #1154 from SpaceVim/layers

Update doc for layers
This commit is contained in:
Wang Shidong 2017-12-21 21:20:44 +08:00 committed by GitHub
commit 8495005056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 67 additions and 11 deletions

View File

@ -68,15 +68,17 @@ The easist way is to download [install.cmd](https://spacevim.org/install.cmd) an
### Project layout
├─ autoload/SpaceVim/api/ APIs
├─ autoload/SpaceVim/layers/ layers
├─ autoload/SpaceVim/plugins/ plugins
├─ autoload/SpaceVim/mapping/ mapping guide
├─ doc/SpaceVim.txt help
├─ docs/ website
├─ wiki/ wiki
├─ bin/ executeable
└─ test/ tests
```txt
├─ autoload/SpaceVim/api/ APIs
├─ autoload/SpaceVim/layers/ layers
├─ autoload/SpaceVim/plugins/ plugins
├─ autoload/SpaceVim/mapping/ mapping guide
├─ doc/SpaceVim.txt help
├─ docs/ website
├─ wiki/ wiki
├─ bin/ executeable
└─ test/ tests
```
### Features
@ -123,3 +125,5 @@ Bitcoin: 1DtuVeg81c2L9NEhDaVTAAbrCR3pN5xPFv
- [Rafael Bodill](https://github.com/rafi) and his vim-config
- [Bailey Ling](https://github.com/bling) and his dotvim
- authors of all the plugins used in SpaceVim.
<!-- vim:set nowrap: -->

View File

@ -26,6 +26,13 @@ function! SpaceVim#layers#load(layer, ...) abort
endif
endfunction
function! SpaceVim#layers#disable(layer) abort
let index = index(g:spacevim_plugin_groups, a:layer)
if index != -1
call remove(g:spacevim_plugin_groups, index)
endif
endfunction
function! s:list_layers() abort
tabnew SpaceVimLayers
nnoremap <buffer> q :q<cr>

View File

@ -394,7 +394,7 @@ endfunction
function! s:inactive() abort
let l = '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep . '%#SpaceVim_statusline_b#'
let secs = [s:filename(), &filetype, s:modes(), s:git_branch()]
let secs = [s:filename(), " " . &filetype, s:modes(), s:git_branch()]
let base = 10
for sec in secs
let len = s:STATUSLINE.len(sec)

View File

@ -25,6 +25,8 @@ description: "General documentation about how to using SpaceVim, including the q
- [Update plugins](#update-plugins)
- [Get SpaceVim log](#get-spacevim-log)
- [Configuration layers](#configuration-layers)
- [Purpose](#purpose)
- [Structure](#structure)
- [Custom Configuration](#custom-configuration)
- [Automatic Generation](#automatic-generation)
- [Alternative directory](#alternative-directory)
@ -240,6 +242,19 @@ Use `:SPDebugInfo!` command will desplay the log of SpaceVim. You also can use `
This section is an overview of layers. A more extensive introduction to writing configuration layers can be found in [SpaceVim's layers page](http://spacevim.org/layers/) (recommended reading!).
### Purpose
Layers help collect related packages together to provide features. For example, the `lang#python` layer provides auto-completion, syntax checking, and REPL support for python files. This approach helps keep configuration organized and reduces overhead for the user by keeping them from having to think about what packages to install. To install all the `python` features the user has just to add the `lang#python` layer to their custom configration file.
### Structure
In SpaceVim, a layer is a single file. In a layer, for example, `autocomplete` layer, the file is `autoload/SpaceVim/layers/autocomplete.vim`, and there are there public functions:
- `SpaceVim#layers#autocomplete#plugins()`: return a list of plugins used in this plugins.
- `SpaceVim#layers#autocomplete#config()`: layer config, such as key bindings and autocmds.
- `SpaceVim#layers#autocomplete#set_variable()`: function for setting layer options.
## Custom Configuration
User configuration can be stored in your ~/.SpaceVim.d directory.
@ -2079,3 +2094,6 @@ As SpaceVim use above bookmarks mappings, so you can not use `a`, `m`, `n`, `p`
[textobj-user]: https://github.com/kana/vim-textobj-user
[textobj-multiblock]: https://github.com/osyo-manga/vim-textobj-multiblock
<!-- vim:set nowrap: -->

View File

@ -4,9 +4,26 @@ description: A list of available layers in SpaceVim.
keywords: layer,layers
---
<!-- vim-markdown-toc GFM -->
- [Introduction](#introduction)
- [Enable layers](#enable-layers)
- [Disable layers](#disable-layers)
- [Available layers](#available-layers)
<!-- vim-markdown-toc -->
## Introduction
SpaceVim is a community-driven vim distribution that seeks to provide layer feature. here is an example for loadding a layer with some specified options:
SpaceVim is a community-driven vim distribution that seeks to provide layer feature.
Layers help collect related packages together to provide features.
This approach helps keep configuration organized and reduces overhead for the user by
keeping them from having to think about what packages to install.
### Enable layers
here is an example for loadding `shell` layer with some specified options:
```vim
call SpaceVim#layers#load('shell',
@ -17,10 +34,20 @@ call SpaceVim#layers#load('shell',
\ )
```
### Disable layers
Some layers are enabled by defalut, here is an example for disable `shell` layer:
```vim
call SpaceVim#layers#disable('shell')
```
<!-- SpaceVim layer list start -->
## Available layers
This is a list of available layers in SpaceVim, to contribute layers, please read the [development page](http://spacevim.org/development/).
| Name | Description |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [autocomplete](https://spacevim.org/layers/autocomplete/) | This layer provides auto-completion to SpaceVim |