bespokoid
10/14/2019 - 3:58 PM

SpaceVim cheatsheet #tools

SpaceVim cheatsheet #tools


title: "Documentation" description: "General documentation about how to using SpaceVim, including the quick start guide and FAQs."


Home >> Documentation

Core Pillars

Four core pillars: Mnemonic, Discoverable, Consistent and “Crowd-Configured”.

If any of these core pillars is violated open an issue and we’ll try our best to fix it.

Mnemonic

Key bindings are organized using mnemonic prefixes like b for buffer, p for project, s for search, h for help, etc…

Discoverable

Innovative real-time display of available key bindings. Simple query system to quickly find available layers, packages, and more.

Consistent

Similar functionalities have the same key bindings everywhere thanks to a clearly defined set of conventions. Documentation is mandatory for any layer that ships with SpaceVim.

Crowd-Configured

Community-driven configuration provides curated packages tuned by power users and bugs are fixed quickly.

Highlighted features

  • Great documentation: access documentation in SpaceVim with :h SpaceVim.
  • Minimalistic and nice graphical UI: you'll love the awesome UI and its useful features.
  • Keep your fingers on the home row: for quicker editing with support for QWERTY and BEPO layouts.
  • Mnemonic key bindings: commands have mnemonic prefixes like [WIN] for all the window and buffer commands or [Unite] for the unite work flow commands.
  • Fast boot time: Lazy-load 90% of plugins with [dein.vim]
  • Lower the risk of RSI: by heavily using the space bar instead of modifiers.
  • Batteries included: discover hundreds of ready-to-use packages nicely organised in configuration layers following a set of conventions.
  • Neovim centric: Dark powered mode of SpaceVim

Screenshots

welcome page

working flow

Neovim on iTerm2 using the SpaceVim color scheme base16-solarized-dark

Depicts a common frontend development scenario with JavaScript (jQuery), SASS, and PHP buffers.

Non-code buffers show a Neovim terminal, a TagBar window, a Vimfiler window and a TernJS definition window.

To get more screenshots, see: issue #415

Who can benefit from this?

  • Elementary Vim users.
  • Vim users pursuing a beautiful appearance.
  • Vim users wanting to lower the risk of RSI.
  • Vim users wanting to learn a different way to edit files.
  • Vim users wanting a simple but deep configuration system.

Update and Rollback

Update SpaceVim itself

There are several methods of updating the core files of SpaceVim. It is recommended to update the packages first; see the next section.

Automatic Updates

NOTE: By default, this feature is disabled. It would slow down the startup of Vim/Neovim. If you like this feature, add automatic_update = 1 to your custom configuration file.

SpaceVim will automatically check for a new version every startup. You have restart Vim after updating.

Updating from the SpaceVim Buffer

Use :SPUpdate SpaceVim in SpaceVim buffer. This command will open a new buffer to show the process of updating.

Updating Manually with git

You can close Vim/Neovim and update the git repository to update manually:

git -C ~/.SpaceVim pull.

Update plugins

Use :SPUpdate command to update all the plugins and SpaceVim itself. After :SPUpdate, you can assign plugins need to be updated. Use Tab to complete plugin names after :SPUpdate.

Get SpaceVim log

Use :SPDebugInfo! command to display the log of SpaceVim. You also can use SPC h I to open a buffer with the issue template.

Custom Configuration

The very first time SpaceVim starts up, it will ask you to choose a mode, then it will create a SpaceVim.d/init.toml in your HOME directory. All User configurations 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 environment variable SPACEVIMDIR. Of course you can also use symlinks to change the location of 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.

All SpaceVim options can be found in :h SpaceVim-config, the key is same as the option name with the prefix g:spacevim_ being removed.

Comprehensive documentation is available for each layer by :h SpaceVim.

Add custom plugins

If you want to add plugins from github, just add the repo name to the custom_plugins section:

[[custom_plugins]]
    name = "lilydjwg/colorizer"
    on_cmd = ["ColorHighlight", "ColorToggle"]
    merged = false

on_cmd option means this plugin will be loaded only when the following commands are called. For more options see :h dein-options.

disable existing plugins

If you want to disable plugins which are added by SpaceVim, you can use SpaceVim disabled_plugins options:

[options]
    # NOTE: the value should be a list, and each item is the name of the plugin.
    disabled_plugins = ["clighter", "clighter8"]

Bootstrap Functions

SpaceVim provides two kinds of bootstrap functions for custom configurations and key bindings, namely bootstrap_before and bootstrap_after. To enable them you need to add bootstrap_before = "myspacevim#before" and/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

function! myspacevim#before() abort
    let g:neomake_enabled_c_makers = ['clang']
    nnoremap jk <Esc>
endfunction

function! myspacevim#after() abort
    iunmap jk
endfunction

The bootstrap_before will be called after custom configuration file is loaded. And the bootstrap_after will be called after Vim Enter autocmd.

If you want to add custom SPC prefix key bindings, you can add them to bootstrap function, be sure the key bindings are not used in SpaceVim.

function! myspacevim#before() abort
    call SpaceVim#custom#SPCGroupName(['G'], '+TestGroup')
    call SpaceVim#custom#SPC('nore', ['G', 't'], 'echom 1', 'echomessage 1', 1)
endfunction

Vim compatible mode

The different key bindings between SpaceVim and origin vim are shown as below.

  • 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 is windows_leader, default value is s.

  • The , key does repeat last f, F, t and T in vim, but in SpaceVim it is the language specified Leader key.

The option is enable_language_specific_leader, default value is 1.

  • The q key does recording, but in SpaceVim it is used for closing window smart. If you still prefer the origin function of q, you can use an empty string to disable this feature.

The option is windows_smartclose, default value is q.

  • The Ctrl-a binding on the command line can auto-complete variable names, but in SpaceVim it moves to the cursor to the beginning of the command line.
  • Ctrl-b in command line mode is mapped to <Left>, which will move cursor to the left.
  • Ctrl-f in command line mode is mapped to <Right>, which will move cursor to the right.

SpaceVim provides a vimcompatible mode, in vimcompatible mode, all the differences above will disappear. You can enable the vimcompatible mode via adding vimcompatible = true to [options] section.

If you want to disable any differences above, use the relevant options. For example, in order to disable language specific leader, you may add the following lines to your configuration file:

[options]
    enable_language_specific_leader = false

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 users by keeping them from having to think about what packages to install. To install all the python features users only need 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 three 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.

Debug upstream plugins

If you found one of the built-in plugins has bugs, and you want to debug that plugin. You can follow these steps:

  1. Disable this plugin Take disabling neomake.vim for instance:
[options]
    disabled_plugins = ["neomake.vim"]
  1. Add a forked plugin or add a local plugin Use toml file to add custom forked plugins:
[[custom_plugins]]
   name = "wsdjeg/neomake.vim"
   # note: you need to disable merged feature
   merged = false

Use the bootstrap_before function to add local plugin:

function! myspacevim#before() abort
    set rtp+=~/path/to/your/localplugin
endfunction

Concepts

Transient-states

SpaceVim defines a wide variety of transient states (temporary overlay maps) where it makes sense. This prevents one from doing repetitive and tedious presses on the SPC key.

When a transient state is active, a documentation is displayed in the transient state buffer. Additional information may as well be displayed in it.

Move Text Transient State:

Interface elements

SpaceVim has a minimalistic and distraction free UI:

  • custom airline with color feedback according to current check status
  • custom icon in sign column and error feedbacks for checker.

Colorschemes

The default colorscheme of SpaceVim is gruvbox. There are two variants of this colorscheme, a dark one and a light one. Some aspects of these colorscheme can be customized in the custom configuration file, read :h gruvbox.

It is possible to define your default themes in your ~/.SpaceVim.d/init.toml with the variable colorschemes. For instance, to specify desert:

[options]
    colorscheme = "desert"
    colorscheme_bg = "dark"
MappingsDescriptions
SPC T nswitch to next random colorscheme listed in colorscheme layer.
SPC T sselect a theme using a unite buffer.

All the included colorschemes can be found in colorscheme layer.

SpaceVim supports true colors in terminal, and it is disabled by default, to enable this feature, you should make sure your terminal supports true colors. For more information see: Colours in terminal.

If your terminal does not support true colors, you can disable SpaceVim true colors feature in [options] section:

    enable_guicolors = false

Font

The default font used by SpaceVim is SauceCodePro Nerd Font Mono. It is recommended to install it on your system if you wish to use it.

To change the default font set the variable guifont in your ~/.SpaceVim.d/init.toml file. By default its value is:

    guifont = "SauceCodePro Nerd Font Mono:h11"

If the specified font is not found, the fallback one will be used (depends on your system). Also note that changing this value has no effect if you are running Vim/Neovim in terminal.

UI Toggles

Some UI indicators can be toggled on and off (toggles start with t and T):

Key BindingsDescriptions
SPC t 8highlight any character past the 80th column
SPC t fdisplay the fill column (by default max_column is 120)
SPC t h htoggle highlight of the current line
SPC t h itoggle highlight indentation levels (TODO)
SPC t h ctoggle highlight indentation current column
SPC t h stoggle syntax highlighting
SPC t itoggle indentation guide at point
SPC t ntoggle line numbers
SPC t btoggle background
SPC t ctoggle conceal
SPC t topen tabs manager
SPC T ~display ~ in the fringe on empty lines
SPC T Ftoggle frame fullscreen
SPC T ftoggle display of the fringe
SPC T mtoggle menu bar
SPC T ttoggle tool bar

Statusline

The core#statusline layer provides a heavily customized powerline with the following capabilities:

  • show the window number
  • show the current mode
  • color code for current state
  • show the index of searching result
  • toggle syntax checking info
  • toggle battery info
  • toggle minor mode lighters
  • show VCS information (branch, hunk summary) (need git and VersionControl layer)
Key BindingsDescriptions
SPC [1-9]jump to the windows with the specific number

Reminder of the color codes for the states:

ModeColor
NormalGrey
InsertBlue
VisualOrange
ReplaceAqua

All the colors based on the current colorscheme

Some elements can be dynamically toggled:

Key BindingsDescriptions
SPC t m btoggle the battery status (need to install acpi)
SPC t m ctoggle the org task clock (available in org layer)(TODO)
SPC t m itoggle the input method
SPC t m mtoggle the minor mode lighters
SPC t m Mtoggle the major mode
SPC t m ntoggle the cat! (If colors layer is declared in your dotfile)(TODO)
SPC t m ptoggle the cursor position
SPC t m ttoggle the time
SPC t m dtoggle the date
SPC t m Ttoggle the mode line itself
SPC t m vtoggle the version control info

nerd font installation:

By default SpaceVim use nerd-fonts, please read the documentation of nerd fonts.

syntax checking integration:

When syntax checking minor mode is enabled, a new element appears showing the number of errors, warnings.

Search index integration:

Search index shows the number of occurrence when performing a search via / or ?. SpaceVim integrates nicely the search status by displaying it temporarily when n or N are being pressed. See the 20/22 segment on the screenshot below.

Battery status integration:

acpi displays the percentage of total charge of the battery as well as the time remaining to charge or discharge completely the battery.

A color code is used for the battery status:

Battery StateColor
ChargingGreen
DischargingOrange
CriticalRed

All the colors are based on the current colorscheme.

Statusline separators:

It is possible to easily customize the statusline separator by setting the statusline_separator variable in your custom configuration file and then redraw the statusline. For instance if you want to set back the separator to the well-known arrow separator add the following snippet to your configuration file:

  statusline_separator = 'arrow'

Here is an exhaustive set of screenshots for all the available separator:

SeparatorScreenshot
arrow
curve
slant
nil
fire

Minor Modes:

The minor mode area can be toggled on and off with SPC t m m.

Unicode symbols are displayed by default. Add statusline_unicode_symbols = false to your custom configuration file, statusline will display ASCII characters instead (may be useful in terminal if you cannot set an appropriate font).

The letters displayed in the statusline correspond to the key bindings used to toggle them.

Key BindingsUnicodeASCIIMode
SPC t 88toggle highlight of characters for long lines
SPC t fffill-column-indicator mode
SPC t sssyntax checking (neomake)
SPC t SSenabled in spell checking
SPC t wwwhitespace mode

colorscheme of statusline:

By default SpaceVim only support colorschemes which has been included in colorscheme layer.

If you want to contribute theme please check the template of a statusline theme.

" the theme colors should be
" [
"    \ [ a_guifg,  a_guibg,  a_ctermfg,  a_ctermbg],
"    \ [ b_guifg,  b_guibg,  b_ctermfg,  b_ctermbg],
"    \ [ c_guifg,  c_guibg,  c_ctermfg,  c_ctermbg],
"    \ [ z_guibg,  z_ctermbg],
"    \ [ i_guifg,  i_guibg,  i_ctermfg,  i_ctermbg],
"    \ [ v_guifg,  v_guibg,  v_ctermfg,  v_ctermbg],
"    \ [ r_guifg,  r_guibg,  r_ctermfg,  r_ctermbg],
"    \ [ ii_guifg, ii_guibg, ii_ctermfg, ii_ctermbg],
"    \ [ in_guifg, in_guibg, in_ctermfg, in_ctermbg],
" \ ]
" group_a: window id
" group_b/group_c: stausline sections
" group_z: empty area
" group_i: window id in insert mode
" group_v: window id in visual mode
" group_r: window id in select mode
" group_ii: window id in iedit-insert mode
" group_in: windows id in iedit-normal mode
function! SpaceVim#mapping#guide#theme#gruvbox#palette() abort
    return [
                \ ['#282828', '#a89984', 246, 235],
                \ ['#a89984', '#504945', 239, 246],
                \ ['#a89984', '#3c3836', 237, 246],
                \ ['#665c54', 241],
                \ ['#282828', '#83a598', 235, 109],
                \ ['#282828', '#fe8019', 235, 208],
                \ ['#282828', '#8ec07c', 235, 108],
                \ ['#282828', '#689d6a', 235, 72],
                \ ['#282828', '#8f3f71', 235, 132],
                \ ]
endfunction

This example is the gruvbox colorscheme, if you want to use same colors when switching between different colorschemes, you may need to set custom_color_palette in your custom configuration file. For example:

custom_color_palette = [
    ["#282828", "#a89984", 246, 235],
    ["#a89984", "#504945", 239, 246],
    ["#a89984", "#3c3836", 237, 246],
    ["#665c54", 241],
    ["#282828", "#83a598", 235, 109],
    ["#282828", "#fe8019", 235, 208],
    ["#282828", "#8ec07c", 235, 108],
    ["#282828", "#689d6a", 235, 72],
    ["#282828", "#8f3f71", 235, 132],
    ]

Tabline

Buffers will be listed on the tabline if there is only one tab, each item contains the index, bufname and the filetype icon. If there are more than one tab, all tabs will be listed on the tabline. Each item can be quickly accessed by using <Leader> number. Default <Leader> is \.

Key BindingsDescriptions
<Leader> 1Jump to index 1 on tabline
<Leader> 2Jump to index 2 on tabline
<Leader> 3Jump to index 3 on tabline
<Leader> 4Jump to index 4 on tabline
<Leader> 5Jump to index 5 on tabline
<Leader> 6Jump to index 6 on tabline
<Leader> 7Jump to index 7 on tabline
<Leader> 8Jump to index 8 on tabline
<Leader> 9Jump to index 9 on tabline

SpaceVim tabline also supports mouse click, left mouse button will switch to buffer, while middle button will delete the buffer.

NOTE: This feature is only supported in Neovim with has('tablineat').

Key BindingsDescriptions
<Mouse-left>Jump to the buffer
<Mouse-middle>Delete the buffer

Tab manager:

You can also use SPC t t to open the tab manager windows.

Key bindings within tab manager windows:

Key BindingsDescriptions
oClose or expand tab windows.
rRename the tab under the cursor.
nCreate new named tab below the cursor tab
NCreate new tab below the cursor tab
xDelete the tab
Ctrl-Shift-UpMove tab backward
Ctrl-Shift-DownMove tab forward
<Enter>Jump to windows under the cursor.

General Key bindings

Window manager

Window manager key bindings can only be used in normal mode. The default leader [WIN] is s, you can change it via windows_leader option:

[options]
    windows_leader = "s"
Key BindingsDescriptions
qSmart buffer close
WIN v:split
WIN VSplit with previous buffer
WIN g:vsplit
WIN GVertically split with previous buffer
WIN tOpen new tab (:tabnew)
WIN oClose other windows (:only)
WIN xRemove buffer, leave blank window
WIN qRemove current buffer
WIN QClose current buffer (:close)
<Tab>Next window or tab
Shift-TabPrevious window or tab

SpaceVim has mapped normal q as smart buffer close, the normal func of q can be get by <Leader> q r, if you want to disable this feature, you can use vimcompatible mode.

KeyModeAction
<Leader> yvisualCopy selection to X11 clipboard ("+y)
Ctrl-cNormalCopy full path of current buffer to X11 clipboard
<Leader> Ctrl-cNormalCopy github.com url of current buffer to X11 clipboard(if it is a github repo)
<Leader> Ctrl-lNormal/visualCopy github.com url of current lines to X11 clipboard(if it is a github repo)
<Leader> pNormal/visualPaste selection from X11 clipboard ("+p)
Ctrl-fNormalSmart page forward (Ctrl-f / Ctrl-d)
Ctrl-bNormalSmart page backwards (C-b / C-u)
Ctrl-eNormalSmart scroll down (3 Ctrl-e/j)
Ctrl-yNormalSmart scroll up (3Ctrl-y/k)
Ctrl-qNormalCtrl-w
Ctrl-xNormalSwitch buffer and placement
<Up>, <Down>NormalSmart up and down
}NormalAfter paragraph motion go to first non-blank char (}^)
<Visual/NormalIndent to left and re-select
>Visual/NormalIndent to right and re-select
<Tab>VisualIndent to right and re-select
Shift-<Tab>VisualIndent to left and re-select
g pNormalSelect last paste
Q / g QNormalDisable EX-mode ()
Ctrl-aCommandNavigation in command line
Ctrl-bCommandMove cursor backward in command line
Ctrl-fCommandMove cursor forward in command line

File Operations

Key BindingsDescriptions
SPC f sWrite (:w)
Ctrl-sWrite (:w)
SPC f WWrite as root (need sudo layer)

Editor UI

Key BindingsDescriptions
<F2>Toggle tagbar
<F3>Toggle Vimfiler
<Leader> [1-9]Jump to the buffer with the num index
Alt-[1-9]Jump to the buffer with the num index, this only works in Neovim
Alt-h / Alt-LeftJump to left buffer in the tabline, this only works in Neovim
Alt-l / Alt-RightJump to Right buffer in the tabline, this only works in Neovim
SPC t SToggle spell checker
SPC t nToggle line number and relativenumber
SPC t lToggle hidden characters (:setlocal nolist!)
SPC t WToggle wrap (:setlocal wrap! breakindent!)
g 0Go to first tab (:tabfirst)
g $Go to last tab (:tablast)
g rGo to previous tab (:tabprevious)
Ctrl-DownMove to split below (Ctrl-w j)
Ctrl-UpMove to upper split (Ctrl-w k)
Ctrl-LeftMove to left split (Ctrl-w h)
Ctrl-RightMove to right split (Ctrl-w l)
*Search selection forwards
#Search selection backwards
, <Space>Remove all spaces at EOL
Ctrl-rReplace selection in visual mode

Native functions

Key bindingsModeAction
<Leader> q rNormalSame as native q
<Leader> q r /NormalSame as native q /, open cmdwin
<Leader> q r ?NormalSame as native q ?, open cmdwin
<Leader> q r :NormalSame as native q :, open cmdwin

Bookmarks management

Bookmarks manager is included in tools layer, to use following key bindings, you need to enable tools layer:

[[layers]]
    name = "tools"
Key BindingsDescriptions
m aShow list of all bookmarks
m mToggle bookmark in current line
m nJump to next bookmark
m pJump to previous bookmark
m iAnnotate bookmark

As SpaceVim use above bookmarks mappings, so you cannot use a, m, n, p or i registers to mark current position, but other registers should work well. If you really need to use these registers, you can map <Leader> m to m in your bootstrap function, then you can use a registers via <Leader> m a.

function! myspacevim#before() abort
    nnoremap <silent><Leader>m m
endfunction

Fuzzy finder

SpaceVim provides five fuzzy find tools, each of them is configured in a layer(unite, denite, leaderf, ctrlp and fzf layer). These layers have the same key bindings and features. But they need different dependencies.

Users only need to load one of these layers, they will be able to get these features.

for example, load the denite layer:

[[layers]]
    name = "denite"

Key bindings

Key bindingsDiscription
<Leader> f <Space>Fuzzy find menu:CustomKeyMaps
<Leader> f pFuzzy find menu:AddedPlugins
<Leader> f eFuzzy find register
<Leader> f hFuzzy find history/yank
<Leader> f jFuzzy find jump, change
<Leader> f lFuzzy find location list
<Leader> f mFuzzy find output messages
<Leader> f oFuzzy find outline
<Leader> f qFuzzy find quick fix
<Leader> f rResumes Unite window

Differences between these layers

Featuredeniteuniteleaderfctrlpfzf
CustomKeyMaps menuyesyesnonono
AddedPlugins menuyesyesnonono
registeryesyesnoyesyes
fileyesyesyesyesyes
yank historyyesyesnonoyes
jumpyesyesnoyesyes
location listyesyesnonoyes
outlineyesyesyesyesyes
messageyesyesnonoyes
quickfix listyesyesnoyesyes
resume windowsyesyesnonono

Key bindings within fuzzy finder buffer

Key BindingsDescriptions
<Tab> / Ctrl-jSelect next line
Shift-<Tab> / Ctrl-kSelect previous line
j kLeave Insert mode (Only for denite/unite)
Ctrl-wDelete backward path
<Enter>Run default action
Ctrl-sOpen in a split
Ctrl-vOpen in a vertical split
Ctrl-tOpen in a new tab
Ctrl-gExit unite

Denite/Unite normal mode key bindings

Key BindingsModeDescriptions
Ctrl-h/k/l/rNormalUn-map
Ctrl-lNormalRedraw
<Tab>NormalSelect actions
<Space>NormalToggle mark current candidate, up
rNormalReplace ('search' profile) or rename
Ctrl-zNormal/insertToggle transpose window

The above key bindings are only part of fuzzy finder layers, please read the layers's documentations.

Discovering

Mappings

Mappings guide

A guide buffer is displayed each time the prefix key is pressed in normal mode. It lists the available key bindings and their short descriptions. The prefix can be [SPC], [WIN] and <Leader>.

The default keys of these prefixs are:

Prefix nameCustom options and default valuesDescriptions
[SPC]NONE / <Space>default mapping prefix of SpaceVim
[WIN]windows_leader / swindow mapping prefix of SpaceVim
<Leader>default vim leaderdefault leader prefix of vim/Neovim

By default the guide buffer will be displayed 1000ms after the keys being pressed. You can change the delay by adding vim option 'timeoutlen' to your bootstrap function.

For example, after pressing <Space> in normal mode, you will see:

This guide shows you all the available key bindings begin with [SPC], you can type b for all the buffer mappings, p for project mappings, etc.

After pressing Ctrl-h in guide buffer, you will get paging and help info in the statusline.

KeysDescriptions
uundo pressing
nnext page of guide buffer
pprevious page of guide buffer

Use SpaceVim#custom#SPC() to define custom SPC mappings. For instance:

call SpaceVim#custom#SPC('nnoremap', ['f', 't'], 'echom "hello world"', 'test custom SPC', 1)

Unite/Denite describe key bindings

It is possible to search for specific key bindings by pressing ? in the root of guide buffer.

To narrow the list, just insert the mapping keys or descriptions of what mappings you want, Unite/Denite will fuzzy find the mappings, to find buffer related mappings:

Then use <Tab> or <Up> and <Down> to select the mapping, press <Enter> to execute that command.

Getting help

Fuzzy finder layer is powerful tool to unite all interfaces. It is meant to be like Helm for Vim. These mappings are for getting help info about functions, variables etc:

Key BindingsDescriptions
SPC h SPCdiscover SpaceVim documentation, layers and packages using fuzzy finder layer
SPC h iget help with the symbol at point
SPC h kshow top-level bindings with which-key
SPC h msearch available man pages

Reporting an issue:

Key BindingsDescriptions
SPC h IOpen SpaceVim GitHub issue page with pre-filled information

Available layers

All layers can be easily discovered via :SPLayer -l accessible with SPC h l.

Available plugins in SpaceVim

All plugins can be easily discovered via <leader> l p.

Toggles

Both the toggles mappings start with [SPC] t or [SPC] T. You can find them in the mapping guide.

Navigating

Point/Cursor

Navigation is performed using the Vi key bindings hjkl.

Key BindingsDescriptions
hmove cursor left (origin Vim key, no mappings)
jmove cursor down (origin Vim key, no mappings)
kmove cursor up (origin Vim key, no mappings)
lmove cursor right (origin Vim key, no mappings)
Hmove cursor to the top of the screen (origin Vim key, no mappings)
Lmove cursor to the bottom of the screen (origin Vim key, no mappings)
SPC j 0go to the beginning of line (and set a mark at the previous location in the line)
SPC j $go to the end of line (and set a mark at the previous location in the line)
SPC t -lock the cursor at the center of the screen

Vim motions with vim-easymotion

quick-jump-link mode (TODO)

https://github.com/easymotion/vim-easymotion/issues/315

Similar to easymotion or f in vimperator for firefox, this mode allows one to jump to any link in help file with two key strokes.

MappingsDescriptions
oinitiate quick jump link mode in help buffer

Unimpaired bindings

MappingsDescriptions
[ SPCInsert space above
] SPCInsert space below
[ bGo to previous buffer
] bGo to next buffer
[ nGo to previous conflict marker
] nGo to next conflict marker
[ fGo to previous file in directory
] fGo to next file in directory
[ lGo to the previous error
] lGo to the next error
[ cGo to the previous vcs hunk (need VersionControl layer)
] cGo to the next vcs hunk (need VersionControl layer)
[ qGo to the previous error
] qGo to the next error
[ tGo to the previous frame
] tGo to the next frame
[ wGo to the previous window
] wGo to the next window
[ eMove line up
] eMove line down
[ pPaste above current line
] pPaste below current line
g pSelect pasted text

Jumping, Joining and Splitting

The SPC j prefix is for jumping, joining and splitting.

Jumping
Key BindingsDescriptions
SPC j 0go to the beginning of line (and set a mark at the previous location in the line)
SPC j $go to the end of line (and set a mark at the previous location in the line)
SPC j bjump backward
SPC j fjump forward
SPC j djump to a listing of the current directory
SPC j Djump to a listing of the current directory (other window)
SPC j ijump to a definition in buffer (denite outline)
SPC j Ijump to a definition in any buffer (denite outline)
SPC j jjump to a character in the buffer (easymotion)
SPC j Jjump to a suite of two characters in the buffer (easymotion)
SPC j kjump to next line and indent it using auto-indent rules
SPC j ljump to a line with avy (easymotion)
SPC j qshow the dumb-jump quick look tooltip (TODO)
SPC j ujump to a URL in the current window
SPC j vjump to the definition/declaration of an Emacs Lisp variable (TODO)
SPC j wjump to a word in the current buffer (easymotion)
Joining and splitting
Key BindingsDescriptions
Jjoin the current line with the next line
SPC j kgo to next line and indent it using auto-indent rules
SPC j nsplit the current line at point, insert a new line and auto-indent
SPC j osplit the current line at point but let point on current line
SPC j ssplit a quoted string or s-expression in place
SPC j Ssplit a quoted string or s-expression with \n, and auto-indent the new line

Window manipulation

Window manipulation key bindings

Every window has a number displayed at the start of the statusline and can be quickly accessed using SPC number.

Key BindingsDescriptions
SPC 1go to window number 1
SPC 2go to window number 2
SPC 3go to window number 3
SPC 4go to window number 4
SPC 5go to window number 5
SPC 6go to window number 6
SPC 7go to window number 7
SPC 8go to window number 8
SPC 9go to window number 9

Windows manipulation commands (start with w):

Key BindingsDescriptions
SPC w <Tab>switch to alternate window in the current frame (switch back and forth)
SPC w =balance split windows
SPC w bforce the focus back to the minibuffer (TODO)
SPC w cDistraction-free reading current window (tools layer)
SPC w CDistraction-free reading other windows via vim-choosewin (tools layer)
SPC w ddelete a window
SPC u SPC w ddelete a window and its current buffer (does not delete the file) (TODO)
SPC w Ddelete another window using vim-choosewin
SPC u SPC w Ddelete another window and its current buffer using vim-choosewin (TODO)
SPC w ttoggle window dedication (dedicated window cannot be reused by a mode) (TODO)
SPC w ftoggle follow mode (TODO)
SPC w Fcreate new tab(frame)
SPC w hmove to window on the left
SPC w Hmove window to the left
SPC w jmove to window below
SPC w Jmove window to the bottom
SPC w kmove to window above
SPC w Kmove window to the top
SPC w lmove to window on the right
SPC w Lmove window to the right
SPC w mmaximize/minimize a window (maximize is equivalent to delete other windows) (TODO, now only support maximize)
SPC w Mswap windows using vim-choosewin
SPC w ocycle and focus between tabs
SPC w p mopen messages buffer in a popup window (TODO)
SPC w p pclose the current sticky popup window (TODO)
SPC w rrotate windows forward
SPC w Rrotate windows backward
SPC w s / SPC w -horizontal split
SPC w Shorizontal split and focus new window
SPC w uundo window layout (used to effectively undo a closed window) (TODO)
SPC w Uredo window layout (TODO)
SPC w v / SPC w /vertical split
SPC w Vvertical split and focus new window
SPC w wcycle and focus between windows
SPC w Wselect window using vim-choosewin

Buffers and Files

Buffers manipulation key bindings

Buffer manipulation commands (start with b):

Key BindingsDescriptions
SPC <Tab>switch to alternate buffer in the current window (switch back and forth)
SPC b .buffer transient state
SPC b bswitch to a buffer (via denite/unite)
SPC b dkill the current buffer (does not delete the visited file)
SPC u SPC b dkill the current buffer and window (does not delete the visited file) (TODO)
SPC b Dkill a visible buffer using vim-choosewin
SPC u SPC b Dkill a visible buffer and its window using ace-window(TODO)
SPC b Ctrl-dkill other buffers
SPC b Ctrl-Dkill buffers using a regular expression(TODO)
SPC b eerase the content of the buffer (ask for confirmation)
SPC b hopen SpaceVim home buffer
SPC b nswitch to next buffer avoiding special buffers
SPC b mopen Messages buffer
SPC u SPC b mkill all buffers and windows except the current one(TODO)
SPC b pswitch to previous buffer avoiding special buffers
SPC b Pcopy clipboard and replace buffer (useful when pasting from a browser)
SPC b Rrevert the current buffer (reload from disk)
SPC b sswitch to the scratch buffer (create it if needed)
SPC b wtoggle read-only (writable state)
SPC b Ycopy whole buffer to clipboard (useful when copying to a browser)
z fMake current function or comments visible in buffer as much as possible (TODO)
Create a new empty buffer
Key BindingsDescriptions
SPC b N hcreate new empty buffer in a new window on the left
SPC b N jcreate new empty buffer in a new window at the bottom
SPC b N kcreate new empty buffer in a new window above
SPC b N lcreate new empty buffer in a new window below
SPC b N ncreate new empty buffer in current window
Special Buffers

In SpaceVim, there are many special buffers, these buffers are created by plugins or SpaceVim itself. And these buffers are not listed.

Files manipulations key bindings

Files manipulation commands (start with f):

Key BindingsDescriptions
SPC f /Find files with find command
SPC f bgo to file bookmarks
SPC f ccopy current file to a different location(TODO)
SPC f C dconvert file from unix to dos encoding
SPC f C uconvert file from dos to unix encoding
SPC f Ddelete a file and the associated buffer with confirmation
SPC f Eopen a file with elevated privileges (sudo layer) (TODO)
SPC f Wsave a file with elevated privileges (sudo layer)
SPC f fopen file
SPC f Ftry to open the file under point
SPC f oFind current file in file tree
SPC f Rrename the current file(TODO)
SPC f ssave a file
SPC f Ssave all files
SPC f ropen a recent file
SPC f ttoggle file tree side bar
SPC f Tshow file tree side bar
SPC f dtoggle disk manager in Windows OS
SPC f yshow and copy current file absolute path in the cmdline
Vim and SpaceVim files

Convenient key bindings are located under the prefix SPC f v to quickly navigate between Vim and SpaceVim specific files.

Key BindingsDescriptions
SPC f v vdisplay and copy SpaceVim version
SPC f v dopen SpaceVim custom configuration file

File tree

SpaceVim uses vimfiler as the default file tree, and the default key binding is <F3>. And SpaceVim also provides SPC f t and SPC f T to open the file tree.

To change the filemanager plugin:

[options]
    # file manager plugins supported in SpaceVim:
    # - vimfiler (default)
    # - nerdtree
    # - defx
    filemanager = "defx"

VCS integration is supported, there will be a column status, this feature may make vimfiler slow, so it is not enabled by default. To enable this feature, add enable_vimfiler_gitstatus = true to your custom configure. Here is a picture for this feature:

There is also an option to config the direction of file tree, by default it is right. To move the file tree to the left, you can use filetree_direction option:

[options]
    filetree_direction = "left"
File tree navigation

Navigation is centered on the hjkl keys with the hope of providing a fast navigation experience like in vifm:

Key BindingsDescriptions
<F3> / SPC f tToggle file explorer
with in file tree
<Left> / hgo to parent node and collapse expanded directory
<Down> / jselect next file or directory
<Up> / kselect previous file or directory
<Right> / lopen selected file or expand directory
NCreate new file under cursor
y yCopy file full path to system clipboard
y YCopy file to system clipboard
PPaste file to the position under the cursor
.toggle visible ignored files
s vSplit edit
s gVertical split edit
pPreview
iSwitch to directory history
vQuick look
g xExecute with vimfiler associated
'Toggle mark current line
VClear all marks
>iecrease filetree screenwidth
<dncrease filetree screenwidth
<Home>Jump to first line
<End>Jump to last line
Ctrl-HomeSwitch to project root directory
Ctrl-rRedraw
Open file with file tree.

If only one file buffer is opened, a file is opened in the active window, otherwise we need to use vim-choosewin to select a window to open the file.

Key BindingsDescriptions
l / <Enter>open file in one window
sgopen file in an vertically split window
svopen file in an horizontally split window

Commands starting with g

After pressing prefix g in normal mode, if you do not remember the mappings, you will see the guide which will tell you the functional of all mappings starting with g.

Key BindingsDescriptions
g #search under cursor backward
g $go to rightmost character
g &repeat last ":s" on all lines
g 'jump to mark
g *search under cursor forward
g +newer text state
g ,newer position in change list
g -older text state
g /stay incsearch
g 0go to leftmost character
g ;older position in change list
g <last page of previous command output
g <Home>go to leftmost character
g Eend of previous word
g Fedit file under cursor(jump to line after name)
g Hselect line mode
g Iinsert text in column 1
g Jjoin lines without space
g Nvisually select previous match
g Qswitch to Ex mode
g Renter VREPLACE mode
g Tprevious tag page
g Umake motion text uppercase
g ]tselect cursor tag
g ^go to leftmost no-white character
g _go to last char
g `jump to mark
g aprint ascii value of cursor character
g dgoto definition
g ego to end of previous word
g fedit file under cursor
g ggo to line N
g hselect mode
g iinsert text after '^ mark
g jmove cursor down screen line
g kmove cursor up screen line
g mgo to middle of screenline
g nvisually select next match
g ogoto byte N in the buffer
g ssleep N seconds
g tnext tag page
g umake motion text lowercase
g ~swap case for Nmove text
g <End>go to rightmost character
g Ctrl-gshow cursor info

Commands starting with z

After pressing prefix z in normal mode, if you do not remember the mappings, you will see the guide which will tell you the functional of all mappings starting with z.

Key BindingsDescriptions
z <Right>scroll screen N characters to left
z +cursor to screen top line N
z -cursor to screen bottom line N
z .cursor line to center
z <Enter>cursor line to top
z =spelling suggestions
z Atoggle folds recursively
z Cclose folds recursively
z Ddelete folds recursively
z Eeliminate all folds
z Fcreate a fold for N lines
z Gmark good spelled (update internal wordlist)
z Hscroll half a screenwidth to the right
z Lscroll half a screenwidth to the left
z Mset foldlevel to zero
z Nset foldenable
z Oopen folds recursively
z Rset foldlevel to deepest fold
z Wmark wrong spelled (update internal wordlist)
z Xre-apply foldlevel
z ^cursor to screen bottom line N
z atoggle a fold
z bredraw, cursor line at bottom
z cclose a fold
z ddelete a fold
z eright scroll horizontally to cursor position
z fcreate a fold for motion
z gmark good spelled
z hscroll screen N characters to right
z itoggle foldenable
z jmode to start of next fold
z kmode to end of previous fold
z lscroll screen N characters to left
z msubtract one from foldlevel
z nreset foldenable
z oopen fold
z radd one to foldlevel
z sleft scroll horizontally to cursor position
z tcursor line at top of window
z vopen enough folds to view cursor line
z wmark wrong spelled
z xre-apply foldlevel and do "zV"
z zsmart scroll
z <Left>scroll screen N characters to right

Searching

With an external tool

SpaceVim can be interfaced with different searching tools like:

The search commands in SpaceVim are organized under the SPC s prefix with the next key is the tool to use and the last key is the scope. For instance, SPC s a b will search in all opened buffers using ag.

If the last key (determining the scope) is uppercase then the current word under the cursor is used as default input for the search. For instance, SPC s a B will search the word under cursor.

If the tool key is omitted then a default tool will be automatically selected for the search. This tool corresponds to the first tool found on the system of the list search_tools, the default order is rg, ag, pt, ack then grep. For instance SPC s b will search in the opened buffers using pt if rg and ag have not been found on the system.

The tool keys are:

ToolKey
aga
grepg
ackk
rgr
ptt

The available scopes and corresponding keys are:

ScopeKey
opened buffersb
buffer directoryd
files in a given directoryf
current projectp

It is possible to search in the current file by double pressing the second key of the sequence, for instance SPC s a a will search in the current file with ag.

Notes:

  • rg, ag and pt are optimized to be used in a source control repository but they can be used in an arbitrary directory as well.
  • It is also possible to search in several directories at once by marking them in the unite buffer.

Beware if you use pt, TCL parser tools also install a command line tool called pt.

Custom searching tool

To change the options of a search tool, you need to use the bootstrap function. The following example shows how to change the default option of searching tool rg.

function! myspacevim#before() abort
    let profile = SpaceVim#mapping#search#getprofile('rg')
    let default_opt = profile.default_opts + ['--no-ignore-vcs']
    call SpaceVim#mapping#search#profile({'rg' : {'default_opts' : default_opt}})
endfunction

The structure of searching tool profile is:

" { 'ag' : {
"   'namespace' : '',         " a single char a-z
"   'command' : '',           " executable
"   'default_opts' : [],      " default options
"   'recursive_opt' : [],     " default recursive options
"   'expr_opt' : '',          " option for enable expr mode
"   'fixed_string_opt' : '',  " option for enable fixed string mode
"   'ignore_case' : '',       " option for enable ignore case mode
"   'smart_case' : '',        " option for enable smart case mode
"   }
"  }
Useful key bindings
Key BindingsDescriptions
SPC r lresume the last completion buffer
SPC s `go back to the previous place before jump
Prefix argumentwill ask for file extensions
Searching in current file
Key BindingsDescriptions
SPC s ssearch with the first found tool
SPC s Ssearch with the first found tool with default input
SPC s a aag
SPC s a Aag with default input
SPC s g ggrep
SPC s g Ggrep with default input
SPC s r rrg
SPC s r Rrg with default input
Searching in buffer directory
Key BindingsDescriptions
SPC s dsearching in buffer directory with default tool
SPC s Dsearching in buffer directory cursor word with default tool
SPC s a dsearching in buffer directory with ag
SPC s a Dsearching in buffer directory cursor word with ag
SPC s g dsearching in buffer directory with grep
SPC s g Dsearching in buffer directory cursor word with grep
SPC s k dsearching in buffer directory with ack
SPC s k Dsearching in buffer directory cursor word with ack
SPC s r dsearching in buffer directory with rg
SPC s r Dsearching in buffer directory cursor word with rg
SPC s t dsearching in buffer directory with pt
SPC s t Dsearching in buffer directory cursor word with pt
Searching in all loaded buffers
Key BindingsDescriptions
SPC s bsearch with the first found tool
SPC s Bsearch with the first found tool with default input
SPC s a bag
SPC s a Bag with default input
SPC s g bgrep
SPC s g Bgrep with default input
SPC s k back
SPC s k Back with default input
SPC s r brg
SPC s r Brg with default input
SPC s t bpt
SPC s t Bpt with default input
Searching in an arbitrary directory
Key BindingsDescriptions
SPC s fsearch with the first found tool
SPC s Fsearch with the first found tool with default input
SPC s a fag
SPC s a Fag with default text
SPC s g fgrep
SPC s g Fgrep with default text
SPC s k fack
SPC s k Fack with default text
SPC s r frg
SPC s r Frg with default text
SPC s t fpt
SPC s t Fpt with default text
Searching in a project
Key BindingsDescriptions
SPC / / SPC s psearch with the first found tool
SPC * / SPC s Psearch with the first found tool with default input
SPC s a pag
SPC s a Pag with default text
SPC s g pgrep
SPC s g pgrep with default text
SPC s k pack
SPC s k Pack with default text
SPC s t ppt
SPC s t Ppt with default text
SPC s r prg
SPC s r Prg with default text

Hint: It is also possible to search in a project without needing to open a file beforehand. To do so use SPC p p and then C-s on a given project to directly search into it like with SPC s p. (TODO)

Background searching in a project

Background search keyword in a project, when searching done, the count will be shown on the statusline.

Key BindingsDescriptions
SPC s jsearching input expr background with the first found tool
SPC s Jsearching cursor word background with the first found tool
SPC s lList all searching result in quickfix buffer
SPC s a jag
SPC s a Jag with default text
SPC s g jgrep
SPC s g Jgrep with default text
SPC s k jack
SPC s k Jack with default text
SPC s t jpt
SPC s t Jpt with default text
SPC s r jrg
SPC s r Jrg with default text
Searching the web
Key BindingsDescriptions
SPC s w gGet Google suggestions in Vim. Opens Google results in Browser.
SPC s w wGet Wikipedia suggestions in Vim. Opens Wikipedia page in Browser.(TODO)

Note: to enable google suggestions in Vim, you need to add enable_googlesuggest = 1 to your custom Configuration file.

Searching on the fly

Key BindingsDescriptions
SPC s g GSearching in project on the fly with default tools

Key bindings in FlyGrep buffer:

Key BindingsDescriptions
<Esc>close FlyGrep buffer
<Enter>open file at the cursor line
<Tab>move cursor line down
Shift-<Tab>move cursor line up
<BackSpace>remove last character
Ctrl-wremove the Word before the cursor
Ctrl-uremove the Line before the cursor
Ctrl-kremove the Line after the cursor
Ctrl-a / <Home>Go to the beginning of the line
Ctrl-e / <End>Go to the end of the line

Persistent highlighting

SpaceVim uses search_highlight_persist to keep the searched expression highlighted until the next search. It is also possible to clear the highlighting by pressing SPC s c or executing the ex command :noh.

Highlight current symbol

SpaceVim supports highlighting of the current symbol on demand and add a transient state to easily navigate and rename these symbols.

It is also possible to change the range of the navigation on the fly to:

  • buffer
  • function
  • visible area

To Highlight the current symbol under point press SPC s h.

Navigation between the highlighted symbols can be done with the commands:

Key BindingsDescriptions
*initiate navigation transient state on current symbol and jump forwards
#initiate navigation transient state on current symbol and jump backwards
SPC s eedit all occurrences of the current symbol
SPC s hhighlight the current symbol and all its occurrence within the current range
SPC s Hgo to the last searched occurrence of the last highlighted symbol

In highlight symbol transient state:

Key BindingsDescriptions
eedit occurrences (*)
ngo to next occurrence
N / pgo to previous occurrence
bsearch occurrence in all buffers
/search occurrence in whole project
<Tab>toggle highlight current occurrence
rchange range (function, display area, whole buffer)
Rgo to home occurrence (reset position to starting occurrence)
Any other keyleave the navigation transient state

Editing

Paste text

Auto-indent pasted text

Text manipulation commands

Text related commands (start with x):

Key BindingsDescriptions
SPC x a #align region at #
SPC x a %align region at %
SPC x a &align region at &
SPC x a (align region at (
SPC x a )align region at )
SPC x a [align region at [
SPC x a ]align region at ]
SPC x a {align region at {
SPC x a }align region at }
SPC x a ,align region at ,
SPC x a .align region at . (for numeric tables)
SPC x a :align region at :
SPC x a ;align region at ;
SPC x a =align region at =
SPC x a ¦align region at ¦
`SPC x a`align region at \
SPC x a SPCalign region at [SPC]
SPC x a aalign region (or guessed section) using default rules (TODO)
SPC x a calign current indentation region using default rules (TODO)
SPC x a lleft-align with evil-lion (TODO)
SPC x a Lright-align with evil-lion (TODO)
SPC x a ralign region at user-specified regexp
SPC x a oalign region at operators +-*/ etc
SPC x ccount the number of chars/words/lines in the selection region
SPC x d wdelete trailing whitespaces
SPC x d SPCDelete all spaces and tabs around point, leaving one space
SPC x g lset lanuages used by translate commands (TODO)
SPC x g ttranslate current word using Google Translate
SPC x g Treverse source and target languages (TODO)
SPC x i cchange symbol style to lowerCamelCase
SPC x i Cchange symbol style to UpperCamelCase
SPC x i icycle symbol naming styles (i to keep cycling)
SPC x i -change symbol style to kebab-case
SPC x i kchange symbol style to kebab-case
SPC x i _change symbol style to under_score
SPC x i uchange symbol style to under_score
SPC x i Uchange symbol style to UP_CASE
SPC x j cset the justification to center
SPC x j fset the justification to full (TODO)
SPC x j lset the justification to left
SPC x j nset the justification to none (TODO)
SPC x j rset the justification to right
SPC x Jmove down a line of text (enter transient state)
SPC x Kmove up a line of text (enter transient state)
SPC x l dduplicate line or region (TODO)
SPC x l ssort lines (TODO)
SPC x l uuniquify lines (TODO)
SPC x ouse avy to select a link in the frame and open it (TODO)
SPC x Ouse avy to select multiple links in the frame and open them (TODO)
SPC x t cswap (transpose) the current character with the previous one
SPC x t Cswap (transpose) the current character with the next one
SPC x t wswap (transpose) the current word with the previous one
SPC x t Wswap (transpose) the current word with the next one
SPC x t lswap (transpose) the current line with the previous one
SPC x t Lswap (transpose) the current line with the next one
SPC x uset the selected text to lower case
SPC x Uset the selected text to upper case
SPC x w ccount the words in the select region
SPC x w dshow dictionary entry of word from wordnik.com (TODO)
SPC x <Tab>indent or dedent a region rigidly (TODO)

Text insertion commands

Text insertion commands (start with i):

Key bindingsDescriptions
SPC i l linsert lorem-ipsum list
SPC i l pinsert lorem-ipsum paragraph
SPC i l sinsert lorem-ipsum sentence
SPC i p 1insert simple password
SPC i p 2insert stronger password
SPC i p 3insert password for paranoids
SPC i p pinsert a phonetically easy password
SPC i p ninsert a numerical password
SPC i uSearch for Unicode characters and insert them into the active buffer.
SPC i U 1insert UUIDv1 (use universal argument to insert with CID format)
SPC i U 4insert UUIDv4 (use universal argument to insert with CID format)
SPC i U Uinsert UUIDv4 (use universal argument to insert with CID format)

Increase/Decrease numbers

Key BindingsDescriptions
SPC n +increase the number under point by one and initiate transient state
SPC n -decrease the number under point by one and initiate transient state

In transient state:

Key BindingsDescriptions
+increase the number under point by one
-decrease the number under point by one
Any other keyleave the transient state

Tips: You can increase or decrease a number by more than once by using a prefix argument (i.e. 10 SPC n + will add 10 to the number under cursor).

Replace text with iedit

SpaceVim uses a powerful iedit mode to quick edit multiple occurrences of a symbol or selection.

Two new modes: iedit-Normal/iedit-Insert

The default color for iedit is red/green which is based on the current colorscheme.

iedit states key bindings

State transitions:

Key BindingsFromto
SPC s enormal or visualiedit-Normal

In iedit-Normal mode:

iedit-Normal mode inherits from Normal mode, the following key bindings are specific to iedit-Normal mode.

Key BindingDescriptions
<Esc>go back to Normal mode
iswitch to iedit-Insert mode, same as i in Normal model
aswitch to iedit-Insert mode, same as a in Normal model
Igo to the beginning of the current occurrence and switch to iedit-Insert mode, same as I in Normal model
Ago to the end of the current occurrence and switch to iedit-Insert mode, same as A in Normal model
<Left>/hMove cursor to left, same as h in Normal model
<Right>/lMove cursor to right, same as l in Normal model
0/<Home>go to the beginning of the current occurrence, same as 0 in Normal model
$/<End>go to the end of the current occurrence, same as $ in Normal model
Cdelete the characters from the cursor to the end in all occurrences and switch to iedit-Insert mode, same as C in Normal model
Ddelete the occurrences, same as D in Normal model
sdelete the character under cursor and switch to iedit-Insert mode, same as s in Normal model
Sdelete the occurrences and switch to iedit-Insert mode, same as S in Normal model
xdelete the character under cursor in all the occurrences, same as x in Normal model
Xdelete the character before cursor in all the occurrences, same as X in Normal model
gggo to first occurrence, same as gg in Normal model
Ggo to last occurrence, same as G in Normal model
ngo to next occurrence
Ngo to previous occurrence
preplace occurrences with last yanked (copied) text
<Tab>toggle current occurrence

In iedit-Insert mode:

Key BindingsDescriptions
Ctrl-g / <Esc>go back to iedit-Normal mode
Ctrl-b / <Left>move cursor to left
Ctrl-f / <Right>move cursor to right
Ctrl-a / <Home>moves the cursor to the beginning of the current occurrence
Ctrl-e / <End>moves the cursor to the end of the current occurrence
Ctrl-wdelete word before cursor
Ctrl-kdelete all words after cursor
Ctrl-udelete all characters before cursor
Ctrl-h / <Backspace>delete character before cursor
<Delete>delete character after cursor

Commenting

Comments are handled by nerdcommenter, it’s bound to the following keys.

Key BindingsDescriptions
SPC ;comment operator
SPC c hhide/show comments
SPC c ltoggle comment lines
SPC c Lcomment lines
SPC c uuncomment lines
SPC c ptoggle comment paragraphs
SPC c Pcomment paragraphs
SPC c scomment with pretty layout
SPC c ttoggle comment to line
SPC c Tcomment to line
SPC c ytoggle comment and yank(TODO)
SPC c Yyank and comment
SPC c $comment current line from cursor to the end of the line

Tips: SPC ; will start operator mode, in this mode, you can use motion command to comment lines. For example, SPC ; 4 j will comment current line and the following 4 lines.

Multi-Encodings

SpaceVim uses utf-8 as default encoding. There are four options for these case:

  • fileencodings (fencs): ucs-bom,utf-8,default,latin1
  • fileencoding (fenc): utf-8
  • encoding (enc): utf-8
  • termencoding (tenc): utf-8 (only supported in Vim)

To fix messy display: SPC e a is the mapping for auto detect the file encoding. After detecting file encoding, you can run the command below to fix the encoding:

set enc=utf-8
write

Code runner and REPL

SpaceVim provides an asynchronously code runner plugin. In most language layer, we have defined a key bidning SPC l r for running current buffer. If you need to add new commands, you can use the bootstrap function. For example: Use F5 to build project asynchronously.

nnoremap <silent> <F5> :call SpaceVim#plugins#runner#open('make')

These following features have been added to runner and repl plugin:

  • Run current file with default command
  • Run code file through system file explorer, only supported in gvim.
  • Run code per Shebang
  • Stop code running
  • View output in Output Window
  • Set default language to run
  • Select language to run
  • REPL support
  • Run selected code snippet

Errors handling

SpaceVim uses neomake to give error feedback on the fly. The checks are only performed at save time by default.

Errors management mappings (start with e):

MappingsDescriptions
SPC t stoggle syntax checker
SPC e cclear all errors
SPC e hdescribe a syntax checker
SPC e ltoggle the display of the list of errors/warnings
SPC e ngo to the next error
SPC e pgo to the previous error
SPC e vverify syntax checker setup (useful to debug 3rd party tools configuration)
SPC e .error transient state

The next/previous error mappings and the error transient state can be used to browse errors from syntax checkers as well as errors from location list buffers, and indeed anything that supports Vim's location list. This includes for example search results that have been saved to a location list buffer.

Custom sign symbol:

SymbolDescriptionsCustom options
Errorerror_symbol
warningwarning_symbol
Infoinfo_symbol

quickfix list movement:

MappingsDescriptions
<Leader> q lOpen quickfix list windows
<Leader> q cclear quickfix list
<Leader> q njump to next item in quickfix list
<Leader> q pjump to previous item in quickfix list

Managing projects

SpaceVim will find the root of the project when a .git directory or a .project_alt.json file is encountered in the file tree.

Project manager commands start with p:

Key BindingsDescriptions
SPC p 'open a shell in project’s root (need the shell layer)

Searching files in project

Key BindingsDescriptions
SPC p ffind files in current project
SPC p /fuzzy search for text in current project
SPC p kkill all buffers of current project
SPC p tfind project root
SPC p plist all projects

EditorConfig

SpaceVim has supported EditorConfig, a configuration file to “define and maintain consistent coding styles between different editors and IDEs.”

To customize your editorconfig experience, read the editorconfig-vim package’s documentation.

Vim Server

SpaceVim starts a server at launch. This server is killed whenever you close your Vim windows.

Connecting to the Vim server

If you are using Neovim, you need to install neovim-remote, then add this to your bashrc.

export PATH=$PATH:$HOME/.SpaceVim/bin

Use svc to open a file in the existing Vim server, or use nsvc to open a file in the existing Neovim server.

Achievements

issues

AchievementsAccount
100th issue(issue)BenBergman
1000th issue(PR)sei40kr
2000th issue(PR)nikolaussucher

Stars, forks and watchers

AchievementsAccount
First stargazersmonkeydterry
100th stargazersrobertofarrell
1000th stargazerslinsongze
2000th stargazersfated
3000th stargazersurso
4000th stargazerswanghe4096
5000th stargazersxxxxha
6000th stargazerscorenel
7000th stargazersmohab1989
8000th stargazerschocopowwwa
9000th stargazersmffathurr