Configuration Basics

Options

Inside your ~/.SpaceVim.d/init.toml , there is an [options] section, under which all general SpaceVim options should be set. Any key defined here gets converted to a global vim variable by SpaceVim. So adding the line foo = "hello" creates g:spacevim_foo with value "hello" . SpaceVim scripts look for these g:spacevim_ prefixed global variables to configure its various settings.

For example, if you wish to use Shougo’s defx.nvim as your filemanager, you can set the option filemanager = "defx" in your TOML. To display absolute line numbers instead of the default relative ones, set relativenumber = false . To opt-out of having SpaceVim manage your CWD, you can set project_rooter_automatically = false . A good portion of these general SpaceVim options are listed in the [SpaceVim help manual]( :help spacevim or open ~/.SpaceVim/doc/SpaceVim.txt ), which unfortunately don't appear to be fully updated. So to get a list of all global variables used by SpaceVim, you can always do :let g: and filter on "g:spacevim_" .

Layers

Layers can come with their own layer-local options. Going back to the earlier example of the git layer, the git wrapper I use is vim-fugitive, but if you prefer lambdalisue’s gina.vim, then just add the last line under your enabled git layer.

[[layers]]

name = "git"

git-plugin = "gina"

It’s always worth first checking both SpaceVim’s built-in help manual ( :help spacevim-layers ) and the online documentation for usage info and options regarding your layer of interest. However as only 104 of 124 available layers are documented online, the most reliable method is reading the layer's source itself, which can all be found inside ~/.SpaceVim/autoload/SpaceVim/layers/ .

Vim-Style Config

Once SpaceVim’s options become insufficient for your customization needs, or if you wish to migrate without abandoning the gems from your own .vimrc , you can supply them to SpaceVim through its hooks mechanism, which SpaceVim calls its "bootstrap functions". These two functions can be specified with bootstrap_before and bootstrap_after in the [options] section of your init.toml config like so:

[options]

# ...

# your other options

# ...

bootstrap_before = "my_config#before"

bootstrap_after = "my_config#after"

bootstrap_before is called prior to the loading of any layers and plugins, while bootstrap_after is called after that when the VimEnter event trigger occurs. In the example above, SpaceVim will look for my_config.vim and call its my_config#after function. This script should be placed inside your ~/.SpaceVim.d/autoload/ directory, which SpaceVim has already conveniently added to your runtimepath . Here is an example of a my_config#after bootstrap function that sets some options not available via the TOML config:

It’s also a good place for you to load and configure custom plugins not belonging to any SpaceVim layer. For example:

Features

SpaceVim is integrated with many valuable tools, such as debugging, testing, tags, offline documentation, etc. But two features I’ve personally found to be indispensable are the fuzzy finding and grepping utilities.

Fuzzy Finding

Currently, there is a choice of 5 fuzzy finders:

ctrlp.vim by Kien

denite.nvim by Shougo

fzf.vim by Junegunn

LeaderF by Yggdroot

unite.vim also by Shougo