入力から補完までディレイが欲しかったから neocomplcache.vim をちょっと弄ったメモ。

neocomplcache は入力中に自動で補完候補をだしてくれる凄く便利なプラグイン。

便利だなーと使ってたけど、だんだんとインサートモードで上下移動する際、補完候補をぐるぐると辿り続けるシュールな状態に耐えられなくなった。
インサートモードでカーソル移動すんなって話かもしれないけど。

こんな感じの設定とかしてみたけど、あまし変わらず。

let g:NeoComplCache_EnableSkipCompletion = 1
let g:NeoComplCache_SkipInputTime = '0.5'

なので、ソースを弄ってみた。

autoload/neocomplcache.vim

 32         " Auto complete events
 33         "autocmd CursorMovedI * call s:complete()
 34         autocmd CursorHoldI * call s:complete()
 35         set updatetime=500

入力止めて 500 ms で補完表示するようになった。

一応、だいたい期待する動作になったけど set updatetime=500 が周りに影響しそうでやめた。
他にやり方がありそうだナー。

もう少し使い込んでみつつ他のも試してみるかー。

作者さんから頂いたアドバイスを元に

neocomplcache.vim 2.6.1

"------------------------------------------------
" neocomplcache settings
let g:AutoComplPop_NotEnableAtStartup = 1
let g:NeoComplCache_EnableAtStartup = 1
let g:NeoComplCache_SmartCase = 1
let g:NeoComplCache_TagsAutoUpdate = 1
let g:NeoComplCache_EnableInfo = 1
let g:NeoComplCache_EnableCamelCaseCompletion = 1
let g:NeoComplCache_MinSyntaxLength = 3
let g:NeoComplCache_EnableSkipCompletion = 1
let g:NeoComplCache_SkipInputTime = '0.5'
inoremap <expr><Up> pumvisible() ? neocomplcache#close_popup()."\<Up>" : "\<Up>"
inoremap <expr><Down> pumvisible() ? neocomplcache#close_popup()."\<Down>" : "\<Down>"

こんな感じの設定したところシュールな状態は解消され、実に快適になった。

ありがとうございましたー!

関連エントリー:

Vim Tips & Plugins

  4 Responses to “neocomplcache.vim 弄り”

  1. 初めまして。neocomplcache作者のShougoです。
    neocomplcacheをお試しいただき、ありがとうございます。

    >こんな感じの設定とかしてみたけど、あまし変わらず。
    >let g:NeoComplCache_EnableSkipCompletion = 1
    >let g:NeoComplCache_SkipInputTime = ’0.5′

    補完スキップの処理を検証してみたところ、確かに問題がありました。
    Ver.2.61で修正しておきましたので、よろしければお試しください。
    スキップの処理が早くなったので、方向キーの移動も快適に動作するはずです。ただし、一回目の移動はポップアップメニューが表示される可能性があります。
    inoremap pumvisible() ? neocomplcache#close_popup().”\” : “\”
    inoremap pumvisible() ? neocomplcache#close_popup().”\” : “\”
    このように設定すると、さらに快適になるでしょう。

  2. 一応URLを貼っておきます。
    http://github.com/Shougo/neocomplcache/tree/v2.61

    <>が消えてしまったので訂正しておきます。
    inoremap <expr><Up> pumvisible() ? neocomplcache#close_popup().”\<Up>” : “\<Up>”
    inoremap <expr><Down> pumvisible() ? neocomplcache#close_popup().”\<Down>” : “\<Down>”

  3. 初めまして。
    Ver2.6.1 & 提示して頂いた設定を試したところ期待通りの動作になりました!
    わざわざ修正&コメントまでして頂き、ありがとうございました。

  4. hi!, I like the composing much! percentage we all retain in contact a lot more regarding your submit with AOL? I call for a professional within this residence to resolve our issue. Might be that’s you! Looking ahead in order to fellow people. Incredibly useful many thanks, It is my opinion your own market will more than likely desire a lot more items such as this maintain the nice effort.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img localsrc="" alt=""> <pre lang="" line="" escaped="" highlight="">