From 50fe3213d1a87471fbb20cc54d40cdeede9165f0 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Thu, 13 Dec 2018 23:07:55 +0800 Subject: [PATCH] Simple support for coc (#2333) * Add coc support * Add coc" * Add coc support --- autoload/SpaceVim.vim | 2 ++ autoload/SpaceVim/layers/autocomplete.vim | 2 ++ autoload/SpaceVim/layers/lang/vim.vim | 3 ++- config/plugins/vimfiler.vim | 4 ++-- docs/cn/layers/autocomplete.md | 4 ++-- docs/layers/autocomplete.md | 8 ++++++-- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 4673ff6f0..9dc615d61 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -203,6 +203,8 @@ if (has('python3') && SpaceVim#util#haspy3lib('neovim')) && " let g:spacevim_autocomplete_method = 'neocomplcache' " endif " < + " + " and you can alse set this option to coc, then coc.nvim will be useed. let g:spacevim_autocomplete_method = 'deoplete' elseif has('lua') let g:spacevim_autocomplete_method = 'neocomplete' diff --git a/autoload/SpaceVim/layers/autocomplete.vim b/autoload/SpaceVim/layers/autocomplete.vim index 9c522b15b..98253d0b2 100644 --- a/autoload/SpaceVim/layers/autocomplete.vim +++ b/autoload/SpaceVim/layers/autocomplete.vim @@ -62,6 +62,8 @@ function! SpaceVim#layers#autocomplete#plugins() abort \ 'on_event' : 'InsertEnter', \ 'loadconf' : 1, \ }]) + elseif g:spacevim_autocomplete_method ==# 'coc' + call add(plugins, ['neoclide/coc.nvim', {'merged': 0}]) elseif g:spacevim_autocomplete_method ==# 'deoplete' call add(plugins, ['Shougo/deoplete.nvim', { \ 'on_event' : 'InsertEnter', diff --git a/autoload/SpaceVim/layers/lang/vim.vim b/autoload/SpaceVim/layers/lang/vim.vim index ee9898209..412f8021f 100644 --- a/autoload/SpaceVim/layers/lang/vim.vim +++ b/autoload/SpaceVim/layers/lang/vim.vim @@ -6,7 +6,6 @@ " License: GPLv3 "============================================================================= - function! SpaceVim#layers#lang#vim#plugins() abort let plugins = [ \ ['syngan/vim-vimlint', { 'on_ft' : 'vim'}], @@ -21,6 +20,8 @@ function! SpaceVim#layers#lang#vim#plugins() abort \ 'loadconf' : 1, \ 'merged' : 0, \ }]) + elseif g:spacevim_autocomplete_method == 'coc' + call add(plugins, ['neoclide/coc-neco', {'merged' : 0}]) endif call add(plugins,['tweekmonster/helpful.vim', {'on_cmd': 'HelpfulVersion'}]) return plugins diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 5b2f7b33d..1a02a9bf8 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -6,8 +6,8 @@ let g:vimfiler_as_default_explorer = get(g:, 'vimfiler_as_default_explorer', 1) let g:vimfiler_restore_alternate_file = get(g:, 'vimfiler_restore_alternate_file', 1) let g:vimfiler_tree_indentation = get(g:, 'vimfiler_tree_indentation', 1) let g:vimfiler_tree_leaf_icon = get(g:, 'vimfiler_tree_leaf_icon', '') -let g:vimfiler_tree_opened_icon = get(g:, 'vimfiler_tree_opened_icon', '▼') -let g:vimfiler_tree_closed_icon = get(g:, 'vimfiler_tree_closed_icon', '▷') +let g:vimfiler_tree_opened_icon = get(g:, 'vimfiler_tree_opened_icon', '-') +let g:vimfiler_tree_closed_icon = get(g:, 'vimfiler_tree_closed_icon', '+') let g:vimfiler_file_icon = get(g:, 'vimfiler_file_icon', '') let g:vimfiler_readonly_file_icon = get(g:, 'vimfiler_readonly_file_icon', '*') let g:vimfiler_marked_file_icon = get(g:, 'vimfiler_marked_file_icon', '√') diff --git a/docs/cn/layers/autocomplete.md b/docs/cn/layers/autocomplete.md index 2c4ace0a9..7c5742cba 100644 --- a/docs/cn/layers/autocomplete.md +++ b/docs/cn/layers/autocomplete.md @@ -49,12 +49,12 @@ SpaceVim 选项 `snippet_engien` 设置为 ultisnips 为了提升用户体验,可以通过使用如下的模块选项来定制自动补全: 1. `auto-completion-return-key-behavior` 选项控制当按下 `Return`/`Enter` 键时的行为, - 默认为 `smart`,可用的值包括如下3种: + 默认为 `complete`,可用的值包括如下3种: - `complete` 补全模式,插入当前选中的列表选项 - `smart` 智能模式,插入当前选中的列表选项,若当前选择的时 snippet,则自动展开代码块。 - `nil` 当设为 nil 时,则采用 Vim 默认的按键行为,插入新行 2. `auto-completion-tab-key-behavior` 选项控制当按下 `Tab` 键时的行为,默认为 - `smart`,可用的值包括如下4种: + `complete`,可用的值包括如下4种: - `smart` 智能模式,自动循环补全列表、展开代码块以及跳至下一个代码块的锚点 - `complete` 补全模式,插入当前选中的列表选项 - `cycle` 循环模式,自动再补全列表之间循环 diff --git a/docs/layers/autocomplete.md b/docs/layers/autocomplete.md index 7983d66e7..3246f5297 100644 --- a/docs/layers/autocomplete.md +++ b/docs/layers/autocomplete.md @@ -48,15 +48,19 @@ To use this configuration layer, add following snippet to your custom configurat You can customize the user experience of auto-completion with the following layer variables: -1. `auto-completion-return-key-behavior` set the action to perform when the `Return`/`Enter` key is pressed, the possible values are: +1. `auto-completion-return-key-behavior` set the action to perform +when the `Return`/`Enter` key is pressed, the possible values are: - `complete` completes with the current selection - `smart` completes with current selection and expand snippet or argvs - `nil` -2. `auto-completion-tab-key-behavior` set the action to perform when the `TAB` key is pressed, the possible values are: +By default it is `complete`. +2. `auto-completion-tab-key-behavior` set the action to +perform when the `TAB` key is pressed, the possible values are: - `smart` cycle candidates, expand snippets, jump parameters - `complete` completes with the current selection - `cycle` completes the common prefix and cycle between candidates - `nil` insert a carriage return +By default it is `complete`. 3. `auto-completion-delay` is a number to delay the completion after input in milliseconds, by default it is 50 ms. 4. `auto-completion-complete-with-key-sequence` is a string of two characters denoting a key sequence that will perform a `complete` action if the sequence as been entered quickly enough. If its value is `nil` then the feature is disabled. 5. `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.