From 72e12c5ee3c68c4cf07ccce729c7152fa1677bd5 Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Tue, 29 Sep 2015 09:27:05 -0700 Subject: [PATCH] Add deoplete configuration --- vim-sync-append.sh | 4 ++++ vim/rc/plugins.rc.vim | 10 +++++++- vim/rc/plugins/deoplete.rc.vim | 35 ++++++++++++++++++++++++++++ vim/rc/plugins/neocomplcache.rc.vim | 12 +--------- vim/rc/plugins/neocomplete.rc.vim | 12 +--------- vim/rc/plugins/omnicompletion.rc.vim | 6 +++++ 6 files changed, 56 insertions(+), 23 deletions(-) create mode 100644 vim/rc/plugins/deoplete.rc.vim create mode 100644 vim/rc/plugins/omnicompletion.rc.vim diff --git a/vim-sync-append.sh b/vim-sync-append.sh index 24664f4..ab74495 100755 --- a/vim-sync-append.sh +++ b/vim-sync-append.sh @@ -33,11 +33,15 @@ echo "Install all bundles" vim +PlugInstall +qall if hash nvim 2>/dev/null; then nvim +PlugInstall +qall + nvim +UpdateRemotePlugins +qall fi +vim --version | grep -q '\+lua' || { echo "Warning: Default vim does not include lua"; } vim --version | grep -q '\+ruby' || { echo "Warning: Default vim does not include ruby."; } vim --version | grep -q '\+python' || { echo "Warning: Default vim does not include python"; } +echo "If using Neovim, install the python modules" + echo "All done!" exit 0 diff --git a/vim/rc/plugins.rc.vim b/vim/rc/plugins.rc.vim index 5d32aba..d4d449f 100644 --- a/vim/rc/plugins.rc.vim +++ b/vim/rc/plugins.rc.vim @@ -79,9 +79,16 @@ command! Todo Grep TODO " }} Fuzzy Find " Autocomplete {{ +call s:smart_source_rc('plugins/omnicompletion') if (has('lua') && (v:version > 703 || v:version == 703 && has('patch885'))) Plug 'Shougo/neocomplete.vim' call s:smart_source_rc('plugins/neocomplete') +elseif has('nvim') && has('python3') + Plug 'Shougo/deoplete.nvim' + Plug 'Shougo/neoinclude.vim' + Plug 'Shougo/neco-syntax' + call s:smart_source_rc('plugins/deoplete') + " Remember :UpdateRemotePlugins else Plug 'Shougo/neocomplcache.vim' call s:smart_source_rc('plugins/neocomplcache') @@ -184,8 +191,9 @@ nmap ptm :Pytest method " }} pytest.vim Plug 'davidhalter/jedi-vim' " jedi-vim {{ -let g:jedi#completions_enabled = 0 let g:jedi#auto_vim_configuration = 0 +let g:jedi#completions_enabled = 0 +let g:jedi#smart_auto_mappings = 0 " }} jedi-vim Plug 'klen/python-mode' " python-mode {{ diff --git a/vim/rc/plugins/deoplete.rc.vim b/vim/rc/plugins/deoplete.rc.vim new file mode 100644 index 0000000..27bd85c --- /dev/null +++ b/vim/rc/plugins/deoplete.rc.vim @@ -0,0 +1,35 @@ +inoremap pumvisible() ? "\" : deoplete#mappings#manual_complete() +inoremap pumvisible() ? "\" : deoplete#mappings#manual_complete() + +if !exists('g:deoplete#sources') + let g:deoplete#sources = {} +endif +if !exists('g:deoplete#keyword_patterns') + let g:deoplete#keyword_patterns = {} +endif +if !exists('g:deoplete#omni#input_patterns') + let g:deoplete#omni#input_patterns = {} +endif + +" Set allowed sources +let g:deoplete#sources._ = ['buffer', 'member', 'file', 'tag'] ", 'omni'] +let g:deoplete#sources.python = ['buffer', 'member', 'file', 'omni'] +" Set default keyword pattern (vim regex) +let g:deoplete#keyword_patterns['default'] = '\h\w*' +" Set omni patters for deoplete (python3 regex) +let g:deoplete#omni#input_patterns.go = '[^.[:digit:] *\t]\%(\.\|->\)' +let g:deoplete#omni#input_patterns.python = '([^. \t]\.|^\s*@|^\s*from\s.+ import |^\s*from |^\s*import )\w*' + +" Default settings +let g:deoplete#enable_at_startup = 1 +let g:deoplete#enable_smart_case = 1 +let g:deoplete#auto_completion_start_length = 2 +let g:deoplete#manual_completion_start_length = 0 + +" Be extra sure that jedi works +let g:jedi#auto_vim_configuration = 0 +let g:jedi#completions_enabled = 0 +let g:jedi#popup_on_dot = 0 +let g:jedi#popup_select_first = 0 +let g:jedi#show_call_signatures = 0 +let g:jedi#smart_auto_mappings = 0 diff --git a/vim/rc/plugins/neocomplcache.rc.vim b/vim/rc/plugins/neocomplcache.rc.vim index 49e713c..304c3e8 100644 --- a/vim/rc/plugins/neocomplcache.rc.vim +++ b/vim/rc/plugins/neocomplcache.rc.vim @@ -1,5 +1,5 @@ let g:neocomplcache_enable_at_startup = 1 -"let g:neocomplcache_enable_smart_case = 1 +let g:neocomplcache_enable_smart_case = 1 let g:neocomplcache_max_list = 10 "let g:neocomplcache_enable_camel_case_completion = 1 let g:neocomplcache_enable_fuzzy_completion = 1 @@ -30,13 +30,3 @@ if !exists('g:neocomplcache_keyword_patterns') let g:neocomplcache_keyword_patterns = {} endif let g:neocomplcache_keyword_patterns['default'] = '[0-9a-zA-Z:#_]\+' - -" Enable omni completion. -autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS -autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags -autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS -" Skip python because we have jedi-vim -" autocmd FileType python setlocal omnifunc=pythoncomplete#Complete -autocmd FileType python setlocal omnifunc=jedi#completions -autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete -autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags diff --git a/vim/rc/plugins/neocomplete.rc.vim b/vim/rc/plugins/neocomplete.rc.vim index 251ae53..8a0c3c1 100644 --- a/vim/rc/plugins/neocomplete.rc.vim +++ b/vim/rc/plugins/neocomplete.rc.vim @@ -1,6 +1,6 @@ let g:acp_enableAtStartup = 0 let g:neocomplete#enable_at_startup = 1 -"let g:neocomplete#enable_smart_case = 1 +let g:neocomplete#enable_smart_case = 1 let g:neocomlete#max_list=10 let g:neocomplete#auto_completion_start_length = 2 let g:neocomplete#manual_completion_start_length = 0 @@ -19,13 +19,3 @@ let g:neocomplete#force_omni_input_patterns['cpp'] = '[^.[:digit:] *\t]\%(\.\|-> let g:neocomplete#force_omni_input_patterns['go'] = '[^.[:digit:] *\t]\%(\.\|->\)' let g:neocomplete#force_omni_input_patterns['python'] = \ '\%([^. \t]\.\|^\s*@\|^\s*from\s.\+import \|^\s*from \|^\s*import \)\w*' - -" Enable omni completion. -autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS -autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags -autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS -" Skip python because we have jedi-vim -" autocmd FileType python setlocal omnifunc=pythoncomplete#Complete -autocmd FileType python setlocal omnifunc=jedi#completions -autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete -autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags diff --git a/vim/rc/plugins/omnicompletion.rc.vim b/vim/rc/plugins/omnicompletion.rc.vim new file mode 100644 index 0000000..37772d3 --- /dev/null +++ b/vim/rc/plugins/omnicompletion.rc.vim @@ -0,0 +1,6 @@ +autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS +autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags +autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS +autocmd FileType python setlocal omnifunc=jedi#completions +autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete +autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags