Skip to content
Liu-Cheng Xu edited this page Jun 9, 2018 · 1 revision

Space-vim uses the Layer concept to organize some useful vim configuration fragments, which originated from spacemacs.

├── layers
    └── +lang
        └── python
            ├── README.md
            ├── config.vim
            └── packages.vim

All the layers are populated under layers/+foo directory, where +foo is called a topic here, e.g., +lang.

Each layer, e.g., python, has parallel composition.

packages.vim

example:

MP 'tmhedberg/SimpylFold'
MP 'python-mode/python-mode'

Add some necessary vim plugins to obtain the layer's functionality.

vim-plug is used as vim plugin manager in space-vim. In each packages.vim, command MP is used to add a vim plugin, which is same as command Plug . As a matter of fact, MP is nothing but a wrapper of Plug for the added option exclude in space-vim.

config.vim

example:

" python-mode {
  let g:pymode_lint_checkers = ['pyflakes']
  let g:pymode_trim_whitespaces = 0
  let g:pymode_options = 0
  let g:pymode_rope = 0

  let g:pymode_indent = 1
  let g:pymode_folding = 0
  let g:pymode_options_colorcolumn = 1
  let g:pymode_breakpoint_bind = '<leader>br'

  if spacevim#LayerLoaded('syntax-checking')
    let g:pymode_lint = 0
  endif
" }

Add some layer-specific settings, in other words, configurations related to the plugins added in packages.vim.

README.md

A brief description for the layer, take this as an example.

Enable a layer

If you want to enable a certain Layer, extend g:spacevim_layers in .spacevim:

let g:spacevim_layers = [
      \ 'fzf', 'unite', 'better-defaults',
      \ 'which-key',
      \ 'python',
      \ ]

Caveats

If you want to add a new Layer:

  • choose a topic (or new a topic) +foo and create a directory with the above three Layer components new-layer in layers/+foo/new-layer directory.

  • Then run :LayerCache, space-vim will update/cache the layers' information. In order to avoid scanning the layers directory every time when you open vim, the required information has been cached in core/autoload/spacevim/info.vim.

  • Add new-layer to g:spacevim_layers

let g:spacevim_layers = [
      \ 'fzf', 'unite', 'better-defaults',
      \ 'which-key',
      \ 'python',
      \ 'new-layer',
      \ ]
Clone this wiki locally