Custom Configuration
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 Userconfiguration can be stored in your ~/.SpaceVim.d
directory.
~/.SpaceVim.d/
will be added to &runtimepath
of vim.
It is also possible to override the location of ~/.SpaceVim.d/
using the environmentvariable SPACEVIMDIR
. Of course you can also use symlinks to change the location ofthis 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.
All SpaceVim options can be found in :h SpaceVim-config
, the key is same asthe option name(just remove g:spacevim_
prefix).
Comprehensive documentation is available for each layer by :h SpaceVim
.
if you want to add custom SPC
prefix key bindings, you can add this to SpaceVim configuration file, be sure the key bindings is not used in SpaceVim.
call SpaceVim#custom#SPCGroupName(['G'], '+TestGroup')
call SpaceVim#custom#SPC('nore', ['G', 't'], 'echom 1', 'echomessage 1', 1)
Bootstrap Functions
SpaceVim provides two kinds of bootstrap functions for custom configurations and key bindings, namely bootstrap_before
and bootstrap_after
. To enable it you need to add bootstrap_before = "myspacevim#before"
or bootstrap_after = "myspacevim#after"
to [options]
section in file .SpaceVim.d/init.toml
. The difference is that these two functions will be called before or after the loading of SpaceVim’s main scripts as they named.
The bootstrap functions should be placed to the autoload
directory in runtimepath
, please refer to :h autoload-functions
for further instructions. In our case, create file .SpaceVim.d/autoload/myspacevim.vim
with contents for example
func! myspacevim#before() abort
let g:neomake_enabled_c_makers = ['clang']
nnoremap jk <esc>
endf
func! myspacevim#after() abort
iunmap jk
endf
Vim Compatible Mode
This a list of different key bindings between SpaceVim and origin vim. If you still want to use this origin function, you can enable vimcompatible mode, via vimcompatible = true
in [options]
section.
The s key does replace cursor char, but in SpaceVim it is the Window key bindings specific leader key by default (which can be set on another key binding in dotfile). If you still prefer the origin function of s, you can use an empty string to disable this feature.
the option isg:spacevim_windows_leader
, default value iss
.The , key does repeat last f, F, t and T in vim, but in SpaceVim it is the language specified Leader key.
the option isg:spacevim_enable_language_specific_leader
, default value is 1.The q key does recording, but in SpaceVim it is used for smart close window.
the option isg:spacevim_windows_smartclose
, default value isq
. If you still prefer the origin function ofq
, you can use an empty string to disable this feature.The Ctrl + a binding on the command line auto-completes variable names, but in SpaceVim it moves to the cursor to the beginning of the command.
Send a PR to add the differences you found in this section.
Private Layers
This section is an overview of layers. A more extensive introduction to writing configuration layers can be found in SpaceVim’s layers page (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 configuration 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.