4.7 KiB
title | description |
---|---|
SpaceVim autocomplete layer | This layer provides auto-completion to SpaceVim |
SpaceVim Layers: autocomplete
Description
This layer provides auto-completion to SpaceVim.
The following completion engines are supported:
- neocomplete - vim with
+lua
- neocomplcache - vim without
+lua
- deoplete - neovim with
+python3
- YouCompleteMe - disabled by default, to enable ycm, see
:h g:spacevim_enable_ycm
Snippets are supported via neosnippet.
Install
To use this configuration layer, add it to your custom configuration file.
call SpaceVim#layers#load('autocomplete')
Configuration
Key bindings
You can customize the user experience of auto-completion with the following layer variables:
auto-completion-return-key-behavior
set the action to perform when theReturn
/Enter
key is pressed, the possible values are:
complete
completes with the current selectionsmart
completes with current selection and expand snippet or argvsnil
auto-completion-tab-key-behavior
set the action to perform when theTAB
key is pressed, the possible values are:
smart
cycle candidates, expand snippets, jump parameterscomplete
completes with the current selectioncycle
completes the common prefix and cycle between candidatesnil
insert a carriage return
auto-completion-complete-with-key-sequence
is a string of two characters denoting a key sequence that will perform acomplete
action if the sequence as been entered quickly enough. If its value isnil
then the feature is disabled.auto-completion-complete-with-key-sequence-delay
is the number of seconds to wait for the auto-completion key sequence to be entered. The default value is 0.1 seconds.
The default configuration of the layer is:
call SpaceVim#layers#load('autocomplete', {
\ 'auto-completion-return-key-behavior' : 'nil',
\ 'auto-completion-tab-key-behavior' : 'smart',
\ 'auto-completion-complete-with-key-sequence' : 'nil',
\ 'auto-completion-complete-with-key-sequence-delay' : 0.1,
\ })
jk
is a good candidate for auto-completion-complete-with-key-sequence
if you don’t use it already.
Snippets directories
The following snippets or directories are added by default:
- Shougo/neosnippet-snippets : neosnippet's default snippets.
- honza/vim-snippets : extra snippets
~/.SpaceVim/snippets/
: SpaceVim runtime snippets.~/.SpaceVim.d/snippets/
: custom global snippets../.SpaceVim.d/snippets/
: custom local snippets (project's snippets)
You can provide additional directories by setting the variable g:neosnippet#snippets_directory
which can take a string in case of a single path or a list of paths.
Show snippets in auto-completion popup
By default, snippets are shown in the auto-completion popup. To disable this feature, set the variable auto-completion-enable-snippets-in-popup
to 0.
call SpaceVim#layers#load('autocomplete', {
\ 'auto-completion-enable-snippets-in-popup' : 0
\ })
LSP supported
Key bindings
auto-complete
Key bindings | Description |
---|---|
<C-n> |
select next candidate |
<C-p> |
select previous candidate |
<Tab> |
base on auto-completion-tab-key-behavior |
<S-Tab> |
select previous candidate |
<Return> |
base on auto-completion-return-key-behavior |
Neosnippet
Key Binding | Description |
---|---|
M-/ |
Expand a snippet if text before point is a prefix of a snippet |
SPC i s |
List all current yasnippets for inserting |