mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:00:04 +08:00
Update autocomplete layer doc (#3743)
This commit is contained in:
parent
ea23a1d37a
commit
366b1ce684
@ -182,13 +182,25 @@ function install_nvim($name)
|
|||||||
$Env:THEMIS_ARGS = '-e -s --headless'
|
$Env:THEMIS_ARGS = '-e -s --headless'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function download_coreutils() {
|
||||||
|
$url = 'https://nchc.dl.sourceforge.net/project/gnuwin32/coreutils/5.3.0/coreutils-5.3.0-bin.zip'
|
||||||
|
$zip = $Env:APPVEYOR_BUILD_FOLDER + '\coreutils.zip'
|
||||||
|
(New-Object Net.WebClient).DownloadFile($url, $zip)
|
||||||
|
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
|
||||||
|
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $Env:APPVEYOR_BUILD_FOLDER + '\coreutils')
|
||||||
|
$Env:PATH = $Env:PATH + ';' + $Env:APPVEYOR_BUILD_FOLDER + '\coreutils\bin'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($Env:CONDITION.StartsWith("Neovim"))
|
if ($Env:CONDITION.StartsWith("Neovim"))
|
||||||
{
|
{
|
||||||
install_nvim $Env:CONDITION
|
install_nvim $Env:CONDITION
|
||||||
|
download_coreutils
|
||||||
}
|
}
|
||||||
elseif ($Env:CONDITION.StartsWith("Vim"))
|
elseif ($Env:CONDITION.StartsWith("Vim"))
|
||||||
{
|
{
|
||||||
install_vim $Env:CONDITION
|
install_vim $Env:CONDITION
|
||||||
|
download_coreutils
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -23,26 +23,16 @@ elif [ "$LINT" = "file-encoding" ]; then
|
|||||||
if [[ -f encoding_log ]]; then
|
if [[ -f encoding_log ]]; then
|
||||||
rm encoding_log
|
rm encoding_log
|
||||||
fi
|
fi
|
||||||
for file in $(git diff --name-only HEAD master | grep .);
|
for file in $(git diff --name-only HEAD master);
|
||||||
do
|
do
|
||||||
encoding=`file -bi $file | cut -f 2 -d";" | cut -f 2 -d=`
|
# get the encoding of a file, based on:
|
||||||
case $encoding in
|
# https://superuser.com/a/351658/618193
|
||||||
utf-8)
|
# It should be -b instead of -bi
|
||||||
exit 0
|
encoding=`file -b --mime-encoding $file`
|
||||||
;;
|
if [ $encoding != "utf-8" ] && [ $encoding != "us-ascii" ];
|
||||||
us-ascii)
|
then
|
||||||
exit 0
|
echo $file " " $encoding >> encoding_log
|
||||||
;;
|
fi
|
||||||
cp936)
|
|
||||||
echo $file >> encoding_log
|
|
||||||
exit 2
|
|
||||||
;;
|
|
||||||
cp835)
|
|
||||||
echo $file >> encoding_log
|
|
||||||
exit 2
|
|
||||||
esac
|
|
||||||
echo $file >> encoding_log
|
|
||||||
exit 2
|
|
||||||
done
|
done
|
||||||
if [[ -s encoding_log ]]; then
|
if [[ -s encoding_log ]]; then
|
||||||
cat encoding_log
|
cat encoding_log
|
||||||
|
@ -36,6 +36,7 @@ test_script:
|
|||||||
- 'echo %THEMIS_HOME%'
|
- 'echo %THEMIS_HOME%'
|
||||||
- 'echo %THEMIS_VIM%'
|
- 'echo %THEMIS_VIM%'
|
||||||
- 'echo %THEMIS_ARGS%'
|
- 'echo %THEMIS_ARGS%'
|
||||||
|
- 'cat --version'
|
||||||
- '%THEMIS_VIM% --version'
|
- '%THEMIS_VIM% --version'
|
||||||
- '%THEMIS_VIM% -Nu test/vimrc -c "Vader! test/**"'
|
- '%THEMIS_VIM% -Nu test/vimrc -c "Vader! test/**"'
|
||||||
build: off
|
build: off
|
||||||
|
@ -11,9 +11,10 @@ lang: zh
|
|||||||
- [模块描述](#模块描述)
|
- [模块描述](#模块描述)
|
||||||
- [启用模块](#启用模块)
|
- [启用模块](#启用模块)
|
||||||
- [模块配置](#模块配置)
|
- [模块配置](#模块配置)
|
||||||
- [快捷键设置](#快捷键设置)
|
- [自动补全方式](#自动补全方式)
|
||||||
- [代码块的设置](#代码块的设置)
|
- [代码块引擎](#代码块引擎)
|
||||||
- [自动补全括号](#自动补全括号)
|
- [自动补全括号](#自动补全括号)
|
||||||
|
- [模块选项](#模块选项)
|
||||||
- [快捷键](#快捷键)
|
- [快捷键](#快捷键)
|
||||||
|
|
||||||
<!-- vim-markdown-toc -->
|
<!-- vim-markdown-toc -->
|
||||||
@ -27,9 +28,12 @@ lang: zh
|
|||||||
- [neocomplete](https://github.com/Shougo/neocomplete.vim) - 需要 Vim 具备 `+lua` 特性
|
- [neocomplete](https://github.com/Shougo/neocomplete.vim) - 需要 Vim 具备 `+lua` 特性
|
||||||
- [neocomplcache](https://github.com/Shougo/neocomplcache.vim) - 当都不具备以上特性时
|
- [neocomplcache](https://github.com/Shougo/neocomplcache.vim) - 当都不具备以上特性时
|
||||||
- [YouCompleteMe](https://github.com/Valloric/YouCompleteMe) - 默认 Ycm 是不会自动启用的,可通过 SpaceVim 选项 `enable_ycm` 来启用
|
- [YouCompleteMe](https://github.com/Valloric/YouCompleteMe) - 默认 Ycm 是不会自动启用的,可通过 SpaceVim 选项 `enable_ycm` 来启用
|
||||||
|
- [coc](https://github.com/neoclide/coc.nvim)
|
||||||
|
- [Completor](https://github.com/maralla/completor.vim) - vim8 且具备 `+python` 或者 `+python3` 特性
|
||||||
|
- [asyncomplete](https://github.com/prabirshrestha/asyncomplete.vim) - Vim8 或者 Neovim ,具备 `timers` 特性
|
||||||
|
|
||||||
代码块自动完成框架默认为[neosnippet](https://github.com/Shougo/neosnippet.vim),可通过
|
代码块引擎默认为[neosnippet](https://github.com/Shougo/neosnippet.vim),可通过
|
||||||
SpaceVim 选项 `snippet_engien` 设置为 ultisnips
|
SpaceVim 选项 `snippet_engine` 设置为 `ultisnips`,将使用 [UltiSnips](https://github.com/sirver/UltiSnips) 作为代码块引擎。
|
||||||
|
|
||||||
## 启用模块
|
## 启用模块
|
||||||
|
|
||||||
@ -45,7 +49,78 @@ SpaceVim 选项 `snippet_engien` 设置为 ultisnips
|
|||||||
自动补全模块的配置,主要包括两个部分,自动补全快捷键的设置、代码块模板以及
|
自动补全模块的配置,主要包括两个部分,自动补全快捷键的设置、代码块模板以及
|
||||||
使用体验的优化
|
使用体验的优化
|
||||||
|
|
||||||
### 快捷键设置
|
|
||||||
|
### 自动补全方式
|
||||||
|
|
||||||
|
默认情况下,SpaceVim 将会根据当前 Vim、Neovim 的版本,自动选择合适的补全插件,
|
||||||
|
但是用户也可以手动设定所要使用的补全插件,目前支持的补全插件包括:
|
||||||
|
|
||||||
|
- `autocomplete_method`: 可以用的值包括:
|
||||||
|
- `ycm`: 使用 `YouCompleteMe`
|
||||||
|
- `neocomplcache`
|
||||||
|
- `coc`: 使用 `coc.nvim`,需要同时启用 `lsp` 模块。
|
||||||
|
- `deoplete`
|
||||||
|
- `asyncomplete`
|
||||||
|
- `completor`
|
||||||
|
|
||||||
|
设置示例:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[options]
|
||||||
|
autocomplete_method = "deoplete"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 代码块引擎
|
||||||
|
|
||||||
|
默认的代码块引擎插件使用的是 `neosnippet`,可以通过 SpaceVim 选项 `snippet_engine` 来修改为 `ultisnips`。
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[options]
|
||||||
|
snippet_engine = "ultisnips"
|
||||||
|
```
|
||||||
|
|
||||||
|
默认情况下,会自动载入以下代码块仓库的代码块模板:
|
||||||
|
|
||||||
|
- [Shougo/neosnippet-snippets](https://github.com/Shougo/neosnippet-snippets):neosnippet 的默认代码块模板
|
||||||
|
- [honza/vim-snippets](https://github.com/honza/vim-snippets):额外的代码块模板
|
||||||
|
|
||||||
|
|
||||||
|
如果 `snippet_engine` 是 `neosnippet`,以下文件夹内的代码块模板会被载入:
|
||||||
|
|
||||||
|
- `~/.SpaceVim/snippets/`:SpaceVim 内置代码块模板
|
||||||
|
- `~/.SpaceVim.d/snippets/`:用户全局代码块模板
|
||||||
|
- `./.SpaceVim.d/snippets/`:当前项目本地代码块模板
|
||||||
|
|
||||||
|
你也可以在启动函数内通过变量 `g:neosnippet#snippets_directory` 添加额外的文件夹,
|
||||||
|
该变量的值可以是一个 `string`,指定文件夹路径,也可是一个 `list`,
|
||||||
|
其内,每一个元素指定一个文件夹路径。
|
||||||
|
|
||||||
|
如果 `snippet_engine` 是 `ultisnips`,以下文件夹内的代码块模板会被载入:
|
||||||
|
|
||||||
|
- `~/.SpaceVim/UltiSnips/`:SpaceVim 内置代码块模板
|
||||||
|
- `~/.SpaceVim.d/UltiSnips/`:用户全局代码块模板
|
||||||
|
- `./.SpaceVim.d/UltiSnips/`:当前项目本地代码块模板
|
||||||
|
|
||||||
|
默认情况下,代码块模板缩写词会在补全列表里面显示,以提示当前输入的内容为一个代码块模板的缩写,
|
||||||
|
如果需要禁用这一特性,可以设置 `auto_completion_enable_snippets_in_popup` 为 false。
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[layers]]
|
||||||
|
name = "autocomplete"
|
||||||
|
auto_completion_enable_snippets_in_popup = false
|
||||||
|
```
|
||||||
|
|
||||||
|
### 自动补全括号
|
||||||
|
|
||||||
|
默认情况下,会自动补全成对的括号,如果需要禁用该功能,可以添加如下配置:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[options]
|
||||||
|
autocomplete_parens = false
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 模块选项
|
||||||
|
|
||||||
为了提升用户体验,可以通过使用如下的模块选项来定制自动补全:
|
为了提升用户体验,可以通过使用如下的模块选项来定制自动补全:
|
||||||
|
|
||||||
@ -79,36 +154,6 @@ SpaceVim 选项 `snippet_engien` 设置为 ultisnips
|
|||||||
通常会建议将 `auto_completion_complete_with_key_sequence` 的值设为 `jk`,如果你不用
|
通常会建议将 `auto_completion_complete_with_key_sequence` 的值设为 `jk`,如果你不用
|
||||||
这一组按键的话。
|
这一组按键的话。
|
||||||
|
|
||||||
### 代码块的设置
|
|
||||||
|
|
||||||
默认情况下,会自动载入以下代码块仓库和文件夹的代码块模板:
|
|
||||||
|
|
||||||
- [Shougo/neosnippet-snippets](https://github.com/Shougo/neosnippet-snippets):neosnippet 的默认代码块模板
|
|
||||||
- [honza/vim-snippets](https://github.com/honza/vim-snippets):额外的代码块模板
|
|
||||||
- `~/.SpaceVim/snippets/`:SpaceVim 内置代码块模板
|
|
||||||
- `~/.SpaceVim.d/snippets/`:用户全局代码块模板
|
|
||||||
- `./.SpaceVim.d/snippets/`:当前项目本地代码块模板
|
|
||||||
|
|
||||||
同时,可以通过修改 bootstrap 方法来设置 `g` 的值,进而设置自定义的代码块模板路径,该值
|
|
||||||
可以是一个 string,表示单个目录,也可以是一个 list,每一个元素表示一个路径。
|
|
||||||
|
|
||||||
默认情况下,代码块模板缩写词会在补全列表里面显示,以提示当前输入的内容为一个代码块模板的缩写,
|
|
||||||
如果需要禁用这一特性,可以设置 `auto_completion_enable_snippets_in_popup` 为 false。
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[[layers]]
|
|
||||||
name = "autocomplete"
|
|
||||||
auto_completion_enable_snippets_in_popup = false
|
|
||||||
```
|
|
||||||
|
|
||||||
### 自动补全括号
|
|
||||||
|
|
||||||
默认情况下,会自动补全成对的括号,如果需要禁用该功能,可以添加如下配置:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[options]
|
|
||||||
autocomplete_parens = false
|
|
||||||
```
|
|
||||||
|
|
||||||
## 快捷键
|
## 快捷键
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ description: "Autocomplete code within SpaceVim, fuzzy find the candidates from
|
|||||||
- [Install](#install)
|
- [Install](#install)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Completion engine](#completion-engine)
|
- [Completion engine](#completion-engine)
|
||||||
|
- [Snippets engine](#snippets-engine)
|
||||||
- [Complete parens](#complete-parens)
|
- [Complete parens](#complete-parens)
|
||||||
- [Layer options](#layer-options)
|
- [Layer options](#layer-options)
|
||||||
- [Snippets directories](#snippets-directories)
|
|
||||||
- [Show snippets in auto-completion popup](#show-snippets-in-auto-completion-popup)
|
- [Show snippets in auto-completion popup](#show-snippets-in-auto-completion-popup)
|
||||||
- [Key bindings](#key-bindings)
|
- [Key bindings](#key-bindings)
|
||||||
- [Completion](#completion)
|
- [Completion](#completion)
|
||||||
@ -69,6 +69,37 @@ here is an example:
|
|||||||
autocomplete_method = "deoplete"
|
autocomplete_method = "deoplete"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Snippets engine
|
||||||
|
|
||||||
|
The default snippets engine is `neosnippet`, the also can be changed to `ultisnips`:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[options]
|
||||||
|
snippet_engine = "ultisnips"
|
||||||
|
```
|
||||||
|
|
||||||
|
The following snippets repos have been added by default:
|
||||||
|
|
||||||
|
- [Shougo/neosnippet-snippets](https://github.com/Shougo/neosnippet-snippets) : neosnippet's default snippets.
|
||||||
|
- [honza/vim-snippets](https://github.com/honza/vim-snippets) : extra snippets
|
||||||
|
|
||||||
|
|
||||||
|
If the `snippet_engine` is `neosnippet`, the following directories will be used:
|
||||||
|
|
||||||
|
- `~/.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.
|
||||||
|
|
||||||
|
If the `snippet_engine` is `ultisnips`, the following directories will be used:
|
||||||
|
|
||||||
|
- `~/.SpaceVim/UltiSnips/`: SpaceVim runtime snippets.
|
||||||
|
- `~/.SpaceVim.d/UltiSnips/`: custom global snippets.
|
||||||
|
- `./.SpaceVim.d/UltiSnips/`: custom local snippets (project's snippets)
|
||||||
|
|
||||||
### Complete parens
|
### Complete parens
|
||||||
|
|
||||||
By default, the parens will be completed automatically, to disabled this feature:
|
By default, the parens will be completed automatically, to disabled this feature:
|
||||||
@ -117,20 +148,6 @@ The default configuration of the layer is:
|
|||||||
|
|
||||||
`jk` is a good candidate for `auto_completion_complete_with_key_sequence` if you don’t use it already.
|
`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](https://github.com/Shougo/neosnippet-snippets) : neosnippet's default snippets.
|
|
||||||
- [honza/vim-snippets](https://github.com/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
|
### Show snippets in auto-completion popup
|
||||||
|
|
||||||
By default, snippets are shown in the auto-completion popup.
|
By default, snippets are shown in the auto-completion popup.
|
||||||
|
Loading…
Reference in New Issue
Block a user