4

プロジェクトのサブディレクトリにmy を自動ロードしたいcscope.outので、このスクリプトを my に追加.vimrcします。これは次のとおりです。

set cscopequickfix=s-,c-,d-,i-,t-,e-

if has("cscope")
    set csprg=/usr/bin/cscope
    set csto=1
    set cst
    set csverb
    set cspc=3
    "add any database in current dir
    if filereadable("cscope.out")
        cs add cscope.out
    "else search cscope.out elsewhere
    else
       let cscope_file=findfile("cscope.out", ".;")
        "echo cscope_file
        if !empty(cscope_file) && filereadable(cscope_file)
            exe "cs add" cscope_file
        endif      
     endif
endif

それは最初に動作します。しかし、私がやろうとするたびに:

:cs find c [tag]  

検索結果は QuickFix リストに表示されますが、結果を含むファイルを開くことができません。

アドバイスをいただければ幸いです。

4

1 に答える 1

4

を追加する場合はcscope.out、正しいパスプレフィックスが設定されていることを確認してください。そうしないと、結果は表示されますが、ファイルをロードできません。

例:

   cs add ../cscope.out ../

したがって、スクリプトを次のように変更する必要があります

 ...
 else
   let cscope_file=findfile("cscope.out", ".;")
   let cscope_pre=matchstr(cscope_file, ".*/")
   "echo cscope_file
   if !empty(cscope_file) && filereadable(cscope_file)
      exe "cs add" cscope_file cscope_pre
   endif
 ...
于 2012-09-03T07:43:18.727 に答える