1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:40:06 +08:00
SpaceVim/config/plugins/deoplete.vim

146 lines
4.9 KiB
VimL
Raw Normal View History

"=============================================================================
" deoplete.vim --- deoplete default config in spacevim
2023-03-26 13:44:47 +08:00
" Copyright (c) 2016-2023 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg@outlook.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
let g:deoplete#enable_at_startup = get(g:, 'deoplete#enable_at_startup', 1)
2018-10-06 10:15:19 +08:00
" deoplete options
let s:profile = SpaceVim#layers#autocomplete#getprfile()
call deoplete#custom#option({
\ 'auto_complete_delay' : g:_spacevim_autocomplete_delay,
\ 'ignore_case' : get(g:, 'deoplete#enable_ignore_case', 1),
\ 'smart_case' : get(g:, 'deoplete#enable_smart_case', 1),
\ 'camel_case' : get(g:, 'deoplete#enable_camel_case', 1),
2022-05-16 22:20:10 +08:00
\ 'refresh_always' : get(g:, 'deoplete#enable_refresh_always', 1),
\ 'nofile_complete_filetypes' : ['denite-filter'],
2018-10-06 10:15:19 +08:00
\ })
if !SpaceVim#layers#lsp#check_filetype('java')
\ && !SpaceVim#layers#lsp#check_server('jdtls')
" java && jsp
call deoplete#custom#var('omni', 'input_patterns', {
\ 'java': [
\ '[^. \t0-9]\.\w*',
\ '[^. \t0-9]\->\w*',
\ '[^. \t0-9]\::\w*',
\ ],
\ 'jsp': ['[^. \t0-9]\.\w*'],
\})
if g:spacevim_enable_javacomplete2_py
call deoplete#custom#option('ignore_sources', {'java': ['omni']})
call deoplete#custom#source('javacomplete2', 'mark', '')
else
call deoplete#custom#option('ignore_sources', {'java': ['javacomplete2', 'around', 'member']})
call deoplete#custom#source('omni', 'mark', '')
call deoplete#custom#source('omni', 'rank', 9999)
endif
2017-02-20 00:07:02 +08:00
endif
2017-10-31 23:39:01 +08:00
" sh
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'sh': ['around', 'member', 'tag', 'syntax']})
2017-10-31 23:39:01 +08:00
2017-02-20 00:07:02 +08:00
" go
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'go': ['omni']})
2018-04-09 20:51:02 +08:00
call deoplete#custom#source('go', 'mark', '')
call deoplete#custom#source('go', 'rank', 9999)
2017-02-20 00:07:02 +08:00
2017-08-29 05:23:16 +08:00
" markdown
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'markdown': ['tag']})
2017-08-29 05:23:16 +08:00
2017-02-20 00:07:02 +08:00
" perl
2018-10-06 10:15:19 +08:00
call deoplete#custom#var('omni', 'input_patterns', {
\ 'perl': [
\ '[^. \t0-9]\.\w*',
\ '[^. \t0-9]\->\w*',
\ '[^. \t0-9]\::\w*',
\ ],
\})
2017-02-20 00:07:02 +08:00
" javascript
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'javascript': ['omni']})
2018-04-09 20:51:02 +08:00
call deoplete#custom#source('ternjs', 'mark', 'tern')
call deoplete#custom#source('ternjs', 'rank', 9999)
2017-02-20 00:07:02 +08:00
2017-09-11 21:32:11 +08:00
" typescript
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'typescript': ['tag','omni', 'syntax']})
2018-04-09 20:51:02 +08:00
call deoplete#custom#source('typescript', 'rank', 9999)
2017-09-11 21:32:11 +08:00
2017-12-25 21:56:33 +08:00
" php two types, 1. phpcd (default) 2. lsp
if SpaceVim#layers#lsp#check_filetype('php')
if has('nvim')
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'php': ['omni', 'around', 'member']})
2017-12-25 21:56:33 +08:00
else
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'php': ['around', 'member']})
2017-12-25 21:56:33 +08:00
endif
else
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'php': ['omni', 'around', 'member']})
2017-12-25 21:56:33 +08:00
endif
2017-02-20 00:07:02 +08:00
2017-05-30 13:38:57 +08:00
" gitcommit
2018-10-06 10:15:19 +08:00
call deoplete#custom#var('omni', 'input_patterns', {
\ 'git-commit': [
\ '[ ]#[ 0-9a-zA-Z]*',
\ ],
\})
2017-05-30 13:38:57 +08:00
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'gitcommit': ['neosnippet']})
2017-05-30 14:03:33 +08:00
2017-02-20 00:07:02 +08:00
" lua
2021-10-05 15:13:10 +08:00
call deoplete#custom#option('ignore_sources', {'lua': ['omni']})
2017-02-20 00:07:02 +08:00
" c c++
2018-04-09 20:51:02 +08:00
call deoplete#custom#source('clang2', 'mark', '')
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'c': ['omni']})
2017-02-20 00:07:02 +08:00
" rust
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'rust': ['omni']})
2018-04-09 20:51:02 +08:00
call deoplete#custom#source('racer', 'mark', '')
2017-02-20 00:07:02 +08:00
2017-12-05 10:37:20 +08:00
" vim
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'vim': ['tag']})
2017-12-05 10:37:20 +08:00
" denite
2019-10-24 00:47:58 +08:00
call deoplete#custom#option('ignore_sources', {'denite-filter': ['denite', 'buffer', 'around', 'member', 'neosnippet']})
2017-11-05 19:09:55 +08:00
" clojure
call deoplete#custom#option('keyword_patterns', {
\ 'clojure': '[\w!$%&*+/:<=>?@\^_~\-\.#]*',
\})
2017-11-05 19:09:55 +08:00
2018-02-07 13:49:44 +08:00
" ocaml
2018-10-06 10:15:19 +08:00
call deoplete#custom#option('ignore_sources', {'ocaml': ['buffer', 'around', 'omni']})
2018-02-07 13:49:44 +08:00
" erlang
2018-10-06 10:15:19 +08:00
call deoplete#custom#var('omni', 'input_patterns', {
\ 'erlang': [
\ '[^. \t0-9]\.\w*',
\ ],
\})
" c#
call deoplete#custom#option('sources', {'cs': ['omnisharp']})
2017-02-20 00:07:02 +08:00
" public settings
2018-04-09 20:51:02 +08:00
call deoplete#custom#source('_', 'matchers', ['matcher_full_fuzzy'])
call deoplete#custom#source('file/include', 'matchers', ['matcher_head'])
2020-09-13 22:14:49 +08:00
if !empty(g:_spacevim_key_sequence)
\ && g:_spacevim_key_sequence !=# 'nil'
\ && g:spacevim_escape_key_binding !=# g:_spacevim_key_sequence
exe printf('inoremap <silent><expr>%s deoplete#manual_complete()', g:_spacevim_key_sequence)
endif
2018-10-06 10:15:19 +08:00
2019-10-05 22:31:49 +08:00
if g:spacevim_autocomplete_parens && exists('g:loaded_delimitMate')
imap <expr><C-h> deoplete#smart_close_popup()."<Plug>delimitMateBS"
imap <expr><BS> deoplete#smart_close_popup()."<Plug>delimitMateBS"
else
inoremap <expr><C-h> deoplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> deoplete#smart_close_popup()."\<C-h>"
endif
2016-12-26 21:11:19 +08:00
set isfname-==
2017-03-06 23:26:26 +08:00
" vim:set et sw=2: