From 5343c44763000a61fa81842cfd11286797fc900e Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 13 Mar 2018 15:38:03 -0400 Subject: [PATCH] Replace neocomplete with deoplete --- .gitmodules | 15 +++++++++++--- README.md | 10 +++++++--- update | 1 + vim/bundle/deoplete.nvim | 1 + vim/bundle/neco-syntax | 1 + vim/bundle/neocomplete.vim | 1 - vim/bundle/nvim-yarp | 1 + vim/bundle/vim-hug-neovim-rpc | 1 + vim/config/keyboard.vim | 25 ----------------------- vim/config/plugins/deoplete.vim | 9 +++++++++ vim/config/plugins/neocomplete.vim | 28 -------------------------- vimrc | 32 ++++++++++++++++++++++++++---- 12 files changed, 61 insertions(+), 64 deletions(-) create mode 160000 vim/bundle/deoplete.nvim create mode 160000 vim/bundle/neco-syntax delete mode 160000 vim/bundle/neocomplete.vim create mode 160000 vim/bundle/nvim-yarp create mode 160000 vim/bundle/vim-hug-neovim-rpc create mode 100644 vim/config/plugins/deoplete.vim delete mode 100644 vim/config/plugins/neocomplete.vim diff --git a/.gitmodules b/.gitmodules index a29d3b4..8dc2211 100644 --- a/.gitmodules +++ b/.gitmodules @@ -103,9 +103,6 @@ [submodule "vim/bundle/ReplaceWithRegister"] path = vim/bundle/ReplaceWithRegister url = https://github.com/prurigro/ReplaceWithRegister.git -[submodule "vim/bundle/neocomplete.vim"] - path = vim/bundle/neocomplete.vim - url = https://github.com/Shougo/neocomplete.vim [submodule "vim/bundle/FastFold"] path = vim/bundle/FastFold url = https://github.com/Konfekt/FastFold.git @@ -124,3 +121,15 @@ [submodule "vim/bundle/lightline-ale"] path = vim/bundle/lightline-ale url = https://github.com/maximbaz/lightline-ale +[submodule "vim/bundle/deoplete.nvim"] + path = vim/bundle/deoplete.nvim + url = https://github.com/Shougo/deoplete.nvim +[submodule "vim/bundle/nvim-yarp"] + path = vim/bundle/nvim-yarp + url = https://github.com/roxma/nvim-yarp +[submodule "vim/bundle/vim-hug-neovim-rpc"] + path = vim/bundle/vim-hug-neovim-rpc + url = https://github.com/roxma/vim-hug-neovim-rpc +[submodule "vim/bundle/neco-syntax"] + path = vim/bundle/neco-syntax + url = https://github.com/Shougo/neco-syntax.git diff --git a/README.md b/README.md index a0f4c09..7363703 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ A theme, config and collection of plugins for Vim. * **Coreutils**: Required by the _update_ script. * **Git**: Required by the _update_ script and git-related plugins. * **Python**: Required by the _gundo.vim_ and _MatchTagAlways_ plugins. -* **Lua**: Required by the _neocomplete.vim_ plugin. ## Optional Requirements ## * **Compilers, Linters and Runtimes**: The ale plugin can use compilers, linters and runtimes to provide real-time syntax checking. -* **CTags**: Required by the _tagbar_ and _neocomplete_ plugins as well as the _gentags_ script ([ctags website](http://ctags.sourceforge.net)). +* **CTags**: Required by the _tagbar_ and _deoplete_ plugins as well as the _gentags_ script ([ctags website](http://ctags.sourceforge.net)). * **Powerline Fonts**: Required to enable the fancier looking status line ([powerline-fonts repo](https://github.com/Lokaltog/powerline-fonts)). +* **Python 3 and Neovim Python Module**: Required for _deoplete_ autocompletion ## Distribution Features ## @@ -60,6 +60,7 @@ As usual, to have your system use `vimpager` in place of `less`, you'll need to * `g:autostartfiler`: **1** = Start the filer file manager when vim is run and the buffer is empty | **0** = Do nothing when vim is run and the buffer is empty (_default_: **1**) * `g:autostartchecker`: **1** = Check syntax once an appropriate file is loaded | **0** = Check syntax only after syntax checking is toggled on (_default_: **0**) * `g:autostarttagbar`: **1** = Have the tagbar load automatically when a compatible format is run | **0** = The tagbar will stay hidden until triggered on demand with its toggle (_default_: **0**) + * `g:disablecompletion`: **1** = Disable _deoplete_ autocompletion | **0** = Enable _deoplete _autocompletion_ if the requirements are met (_default_: **0**) * `g:disableautotags`: **1** = Prevent tags from being automatically generated and highlighted | **0** = Automatically generate and highlight tags (_default_: **0**) * `g:disablelinebreaks`: **1** = Override filetype plugins so linebreaks never occur | **0** = Linebreaks are disabled by default, but filetype plugins can override this setting (_default_: **0**) * `g:powerlinefonts`: **1** = Render the statusline using characters available with powerline-patched fonts | **0** = Render the statusbar with less attractive but more compatible characters available in all fonts (_default_: **0**) @@ -160,6 +161,10 @@ For a complete list of mappings specific to **darkcloud-vimconfig**, check the l * [ale](https://github.com/w0rp/ale): Asynchronous Lint Engine * [autoswap.vim](https://github.com/vim-scripts/autoswap.vim): Switch to open editor window instead of asking what to do with swapfile. * [cosco.vim](https://github.com/lfilho/cosco.vim): VIM colon and semicolon insertion bliss +* [deoplete.nvim](https://github.com/Shougo/deoplete.nvim): Dark powered asynchronous completion framework for neovim/Vim8 + * [neco-syntax](https://github.com/Shougo/neco-syntax): Syntax source for neocomplete/deoplete/ncm + * [nvim-yarp](https://github.com/roxma/nvim-yarp): Yet Another Remote Plugin Framework for Neovim + * [vim-hug-neovim-rpc](https://github.com/roxma/vim-hug-neovim-rpc): A compatibility layer for neovim rpc client working on vim8 * [editorconfig-vim](https://github.com/editorconfig/editorconfig-vim): EditorConfig plugin for Vim that auto-configures certain settings when a .editorconfig file is present * [emmet-vim](https://github.com/mattn/emmet-vim): Support for expanding abbreviations. * [webapi-vim](https://github.com/mattn/webapi-vim): A web library used by emmet to provide support for custom snippets. @@ -169,7 +174,6 @@ For a complete list of mappings specific to **darkcloud-vimconfig**, check the l * [incsearch.vim](https://github.com/haya14busa/incsearch.vim): Improved incremental searching for Vim. * [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim. * [MatchTagAlways](https://github.com/Valloric/MatchTagAlways): A Vim plugin that always highlights the enclosing html/xml tags. -* [neocomplete.vim](https://github.com/Shougo/neocomplete.vim): Next generation completion framework after neocomplcache. * [patchreview-vim](https://github.com/junkblocker/patchreview-vim): A Vim plugin for doing single, multi-patch or diff code reviews. * [rename.vim](https://github.com/danro/rename.vim): Rename the current file in the vim buffer + retain relative path. * [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister): Replace text with the contents of a register (for paste+replace without writing over the buffer). diff --git a/update b/update index 10407f4..9ba5d5d 100755 --- a/update +++ b/update @@ -121,6 +121,7 @@ printf '\n%s\n' "$cbg_black ~~~ DarkCloud Vimconfig Update Tool ~~~ $c_reset" printf '%s\n%s\n\n' '"Autostart Filer in empty buffers: (*1:filer loads in new empty buffers | 0:filer must be triggered)' '"let g:autostartfiler = 1' printf '%s\n%s\n\n' '"Autocheck syntax checking: (1:start toggled on | *0:start toggled off)' '"let g:autostartchecker = 0' printf '%s\n%s\n\n' '"Autoload Tagbar: (1:start open | *0:start closed)' '"let g:autostarttagbar = 0' + printf '%s\n%s\n\n' '"Disable Completion: (1:disable completion | *0:enable completion if requirements are met)' '"let g:disablecompletion = 0' printf '%s\n%s\n\n' '"Disable automatic tag generation and highlighting: (1:force disabled tag generation and highlighting | *0:enable automatic tag generation and highlighting)' '"let g:disableautotags = 0' printf '%s\n%s\n\n' '"Disable automatic linebreaking: (1:force disabled globally | *0:let the filetype decide)' '"let g:disablelinebreaks = 0' printf '%s\n%s\n\n' '"Enable Powerline fonts: (1:expect powerline font | *0:expect regular font)' '"let g:powerlinefonts = 0 "(set powerline font for gvim and terminal when enabled)' diff --git a/vim/bundle/deoplete.nvim b/vim/bundle/deoplete.nvim new file mode 160000 index 0000000..c3c9406 --- /dev/null +++ b/vim/bundle/deoplete.nvim @@ -0,0 +1 @@ +Subproject commit c3c9406bfb4207c057d6a366c88466256a6ea2bd diff --git a/vim/bundle/neco-syntax b/vim/bundle/neco-syntax new file mode 160000 index 0000000..98cba4a --- /dev/null +++ b/vim/bundle/neco-syntax @@ -0,0 +1 @@ +Subproject commit 98cba4a98a4f44dcff80216d0b4aa6f41c2ce3e3 diff --git a/vim/bundle/neocomplete.vim b/vim/bundle/neocomplete.vim deleted file mode 160000 index 1401a1c..0000000 --- a/vim/bundle/neocomplete.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1401a1c6ab56546c55804ba09e6c9fe87654e954 diff --git a/vim/bundle/nvim-yarp b/vim/bundle/nvim-yarp new file mode 160000 index 0000000..b222af8 --- /dev/null +++ b/vim/bundle/nvim-yarp @@ -0,0 +1 @@ +Subproject commit b222af8dbbfb35c6d833fd76a940f6ca2fe322fa diff --git a/vim/bundle/vim-hug-neovim-rpc b/vim/bundle/vim-hug-neovim-rpc new file mode 160000 index 0000000..e8af9b2 --- /dev/null +++ b/vim/bundle/vim-hug-neovim-rpc @@ -0,0 +1 @@ +Subproject commit e8af9b262bfcae1b2f5c755a099cba9687c33a0a diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index 83e2084..aefcebb 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -171,12 +171,6 @@ " | (I) -> cut line before cursor during input " | (I) -> paste what's been cut during input " -" (autocompletion) -" | (I) -> (neocomplete) close the popup and -" | (I) -> (neocomplete) select/cycle popup completion -" | (I) -> (neocomplete) close the popup and -" | (I) -> (neocomplete) undo the most recent completion -" " (fixing-and-formatting) " J | (N) -> split document into lines of tw or 80 " J | (V) -> split selection into lines of tw or 80 @@ -684,25 +678,6 @@ inoremap u "} - "AUTOCOMPLETION:{ - if !has('nvim') && has('lua') - "neocomplete close popup and save indent - inoremap =neocache_cr() - function! s:neocache_cr() - return pumvisible() ? "\" : "\" - endfunction - - "neocomplete tab completion - inoremap pumvisible() ? "\" : "\" - - "neocomplete close popup - inoremap neocomplete#smart_close_popup()."\" - - "neocomplete undo completion - inoremap neocomplete#undo_completion() - endif - "} - "FIXING AND FORMATTING:{ "format width to text width (or 80 chars if text width is 0) nnoremap J ':let b:tw=&textwidth:if (b:tw == 0)set tw=80endifgg0vG$gq:if (b:tw == 0)set tw=0let b:tw=80endif:echo "Document has been formatted to a width of ".b:tw." characters"' diff --git a/vim/config/plugins/deoplete.vim b/vim/config/plugins/deoplete.vim new file mode 100644 index 0000000..c38f3bd --- /dev/null +++ b/vim/config/plugins/deoplete.vim @@ -0,0 +1,9 @@ +"disable completion (default: 0) +if !exists("g:disablecompletion") + let g:disablecompletion = 0 +endif + +if !g:disablecompletion && g:python_neovim + let g:deoplete#enable_at_startup = 1 + let deoplete#tag#cache_limit_size = 5000000 +endif diff --git a/vim/config/plugins/neocomplete.vim b/vim/config/plugins/neocomplete.vim deleted file mode 100644 index 877ba0b..0000000 --- a/vim/config/plugins/neocomplete.vim +++ /dev/null @@ -1,28 +0,0 @@ -let g:neocomplete#enable_at_startup=1 -let g:neocomplete#enable_smart_case=1 -let g:neocomplete#sources#syntax#min_keyword_length=3 - -if !exists('g:neocomplete#sources#omni#input_patterns') - let g:neocomplete#sources#omni#input_patterns = {} -endif - -let g:neocomplete#sources#omni#input_patterns.c='[^.[:digit:] *\t]\%(\.\|->\)\%(\h\w*\)\?' -let g:neocomplete#sources#omni#input_patterns.cpp='[^.[:digit:] *\t]\%(\.\|->\)\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?' -let g:neocomplete#sources#omni#input_patterns.xml='<[^>]*' -let g:neocomplete#sources#omni#input_patterns.html='<[^>]*' -let g:neocomplete#sources#omni#input_patterns.xhtml='<[^>]*' -let g:neocomplete#sources#omni#input_patterns.markdown='<[^>]*' -let g:neocomplete#sources#omni#input_patterns.css='^\s\+\w+\|\w+[):;]?\s\+\|[@!]' -let g:neocomplete#sources#omni#input_patterns.less='^\s\+\w+\|\w+[):;]?\s\+\|[@!]' -let g:neocomplete#sources#omni#input_patterns.javascript='[^. \t]\.\%(\h\w*\)\?' -let g:neocomplete#sources#omni#input_patterns.json='[^. \t]\.\%(\h\w*\)\?' -let g:neocomplete#sources#omni#input_patterns.python='[^. *\t]\.\h\w*\|\h\w*::' -let g:neocomplete#sources#omni#input_patterns.ruby='[^. *\t]\.\w*\|\h\w*::' -let g:neocomplete#sources#omni#input_patterns.php='[^. \t]->\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?' -let g:neocomplete#sources#omni#input_patterns.actionscript='[^. \t][.:]\h\w*' -let g:neocomplete#sources#omni#input_patterns.python3='[^. *\t]\.\h\w*\|\h\w*::' -let g:neocomplete#sources#omni#input_patterns.go='\h\w*\%.' -let g:neocomplete#sources#omni#input_patterns.perl='\h\w*->\h\w*\|\h\w*::' -let g:neocomplete#sources#omni#input_patterns.java='\%(\h\w*\|)\)\.' -let g:neocomplete#sources#omni#input_patterns.objc='\h\w\+\|\h\w*\%(\.\|->\)\h\w*' -let g:neocomplete#sources#omni#input_patterns.objj='[\[ \.]\w\+$\|:\w*$' diff --git a/vimrc b/vimrc index 9e4c073..37a659f 100644 --- a/vimrc +++ b/vimrc @@ -35,10 +35,27 @@ "Load Settings: runtime config/settings.vim - "Init Plugin Loader: + "Initialize Plugins: let pathogen_disabled = [] - " disable incompatible plugins + " configure pythonx and the python_neovim variable to determine whether deoplete should be loaded + if has('python3') + set pyxversion=3 + + redir => python_neovim_check + silent pythonx exec("import pkgutil\nneovim = pkgutil.find_loader('neovim')\nfound = neovim is not None\nprint(found)") + redir END + + if substitute(python_neovim_check, '^\n*\([^\n]*\)\n*$', '\1', '') == 'True' + let g:python_neovim = 1 + else + let g:python_neovim = 0 + endif + else + let g:python_neovim = 0 + endif + + " disable incompatible/unnecessary plugins if has('nvim') call add(pathogen_disabled, 'vim-fixkey') endif @@ -48,10 +65,17 @@ call add(pathogen_disabled, 'MatchTagAlways') endif - if !has('lua') - call add(pathogen_disabled, 'neocomplete.vim') + if !g:python_neovim + call add(pathogen_disabled, 'deoplete.nvim') + call add(pathogen_disabled, 'neco-syntax') + call add(pathogen_disabled, 'nvim-yarp') + call add(pathogen_disabled, 'vim-hug-neovim-rpc') + elseif has('nvim') + call add(pathogen_disabled, 'nvim-yarp') + call add(pathogen_disabled, 'vim-hug-neovim-rpc') endif + " use pathogen to load plugins that haven't been disabled runtime bundle/vim-pathogen/autoload/pathogen.vim "Load Keymappings: