長らくneocomplete.vimを使っていた(と言ってもREADMEの設定のまま)のですが、既に開発が終わっているということで次期バージョン?のdeoplete.nvimを導入することにしました。
Note: Active development on neocomplete.vim has stopped. The only future changes will be bug fixes.
Shougo/neocomplete.vim: Next generation completion framework after neocomplcache
事前準備
deoplete.nvimを使うにはif_python3が必要ということなので確認してみます。
:echo has("python3")
0
どうやら入っていないようなので、vimをインストールし直すことにします。
MacにインストールされているPythonは2系なので、homebrewで3系をインストールします。
$ brew install python3 Error: python3 3.5.2 is already installed To upgrade to 3.6.4_2, run `brew upgrade python3`
どうやら既にインストールされているようです…せっかくなのでアップグレードしておきます。
次にvimのPython3を有効にした状態でインストールし直します。
まずはオプションを確認します。
$ brew info vim
vim: stable 8.0.1450 (bottled), HEAD
Vi 'workalike' with many additional features
https://vim.sourceforge.io/
Conflicts with:
ex-vi (because vim and ex-vi both install bin/ex and bin/view)
/usr/local/Cellar/vim/8.0.0055 (1,710 files, 23.3MB)
Built from source on 2016-11-03 at 01:39:22 with: --with-lua
/usr/local/Cellar/vim/8.0.1250 (1,419 files, 25.3MB)
Built from source on 2017-11-16 at 08:33:37 with: --with-lua
/usr/local/Cellar/vim/8.0.1300 (1,423 files, 25.4MB) *
Built from source on 2017-11-21 at 11:43:30 with: --with-lua
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/vim.rb
==> Dependencies
Required: perl ✘, ruby ✘
Recommended: python ✘
Optional: gettext <img draggable="false" data-mce-resize="false" data-mce-placeholder="1" data-wp-emoji="1" class="emoji" alt="✔" src="https://s.w.org/images/core/emoji/2.4/svg/2714.svg">, lua ✘, luajit ✘, python3 <img draggable="false" data-mce-resize="false" data-mce-placeholder="1" data-wp-emoji="1" class="emoji" alt="✔" src="https://s.w.org/images/core/emoji/2.4/svg/2714.svg">
==> Options
--with-client-server
Enable client/server mode
--with-gettext
Build vim with National Language Support (translated messages, keymaps)
--with-lua
Build vim with lua support
--with-luajit
Build with luajit support
--with-override-system-vi
Override system vi
--with-python3
Build vim with python3 instead of python[2] support
--with-tcl
Build vim with tcl support
--without-python
Build vim without python support
--HEAD
Install HEAD version
–with-python3とすれば良さそうです。
$ brew uninstall vim Uninstalling /usr/local/Cellar/vim/8.0.1300... (1,423 files, 25.4MB) vim 8.0.0055, 8.0.1250 2 are still installed. Remove all versions with `brew uninstall --force vim`. brew install vim --with-python3
Python3が有効になったかを確認してみます。
echo has("python3")
1
無事有効になっていることが確認できました。
続いてneovimというPythonのパッケージをインストールします。
$ pip3 install neovim
deoplete.nvimをインストール
ようやくdeoplete.nvimをインストールします。
今はneobundle.vimを使っているのですが、こちらもそのうちdein.vimに乗り換えようかと思います。
NeoBundle 'Shougo/deoplete.nvim' NeoBundle 'roxma/nvim-yarp' NeoBundle 'roxma/vim-hug-neovim-rpc'
最後に設定を追加して完了です。
let g:deoplete#enable_at_startup = 1
とりあえず大きく変わった感触はないのですが、使いながら最適化していこうかと思います。