Vim の mercurial レポジトリの HEAD が ver7.4a になってた
およそ2ヶ月ほど更新が途切れておりましたが生きています。お久しぶりです。
Vimを最強のPython開発環境にする2 - Λlisue's blog この記事を読んで、一念発起、Vimの環境を徹底的に整備しました(Λlisueさんありがとうございます!)。その中で、NeoComplcacheに代わる新しい補完PluginとしてNeoCompleteが紹介されていました。Vim 7.3.885以上かつLuaインタプリタ装備の環境下で使用でき、NeoComplcacheよりも高速に動作するということで、入れてみようとしたのですが、UbuntuのパッケージになっているVimは7.3.5xxだったのでVimをコンパイルする必要がありました。
1. 環境
- Ubuntu 13.04
2. インストール
# 依存 sudo aptitude install lua5.2 mercurial # Mercurialレポジトリのクローン hg clone https://vim.googlecode.com/hg/ vim cd vim # コンパイル ./configure --with-features=huge \ --disable-darwin \ --disable-selinux \ --enable-luainterp \ --enable-multibyte \ --enable-xim \ --enable-fontset \ make sudo make install
※インストール方法の詳細に関してはΛlisueさんの記事 Debian wheezy (64 bit)に最新版のVimを入れたメモ - Λlisue's blog を参照してください。
3. NeoCompleteのインストール
さて、ここで紹介記事のようにNeoCompleteをインストールしてみます。当然パッケージ管理はNeoBundleですね。NeoBundleがインストールされていない方はGoogle先生にお尋ねください。
" bundleするプラグインのパス(環境により読み替えてください) let s:bundle_root = expand('~/.vim/bundle') " neobundleのパス(環境によりry) let s:neobundle_root = expand('~/.vim/neobundle.vim') if has('vim_starting') execute 'set runtimepath+=' . s:neobundle_root endif call neobundle#rc(s:bundle_root) NeoBundleFetch 'Shougo/neobundle.vim' " 条件を満たせばNeoComplete、満たさないときはNeoComplcacheを使う if has('lua') && v:version >= 703 && has('patch885') NeoBundle "Shougo/neocomplete.vim" " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplete. let g:neocomplete#enable_at_startup = 1 " Use smartcase. let g:neocomplete#enable_smart_case = 1 " Set minimum syntax keyword length. let g:neocomplete#sources#syntax#min_keyword_length = 3 let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' else NeoBundle 'Shougo/neocomplcache.vim' " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Set minimum syntax keyword length. let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' endif
さて、ここでVimを再起動し、:NeoBundleInstallすると…
NeoComplcacheがインストールされてしまいますね
4. 条件式の変更
ここでおもむろに、Vimのバージョンを確認してみます。:versionとコマンドを叩くと…
VIM - Vi IMproved 7.4a BETA (2013 Jul 6, compiled Jul 14 2013 15:16:58)
Included patches: 1-18
おっと! いつの間にかVim7.4a betaが利用できるようになっていたのですね!
mercurialのリポジトリをクローンするときにブランチを指定しなかったので、HEADが入ってしまったようです。
7.4なら当然7.3.885よりも進んだpatchが取り込まれているはずなので、Vim7.4でもNeoCompleteが使えるように条件を変更します。
" 条件を満たせばNeoComplete、満たさないときはNeoComplcacheを使う " if has('lua') && v:version >= 703 && has('patch885') if has('lua') && ( (v:version == 703 && has('patch885')) || v:version >= 704 )
これで無事NeoCompleteが使えるようになりました。直感的な補完にスピードが加わって、非常に使いやすいです。
※ Mercurialのブランチをvim73にするという手もありますが…