3

私はVimでctagsを何年も使用していますが、オムニコンプリートを発見したばかりです。(良いように思える。)

ただし、問題があります。オムニコンプリートを正しく機能させるには、タグを生成するときに--extra = + qオプションを使用する必要があります。これは問題ありませんが、これにより、一般的なタグブラウジングの動作が変更されます。 。

たとえば、Vimでタブを完成させるタグ名の場合、クラスの「階層」に「タグ付け」したくありません。つまり、タブを完成させる「クラス」の場合、「ClassA、ClassA :: var1、ClassA::var2」を取得します。 、ClassB "、" ClassA、ClassB "の代わりに-しかし、-extra =+qを使用するとそれが起こります。

だから私は2つのことのうちの1つを追いかけていると思います。いずれか:1。「タグ階層」がタグファイルに存在する場合でも、それらの階層へのタブ補完を無効にする機能。または、2.オムニコンプリートおよび一般的なタグブラウジングに異なる名前のタグファイル(つまり、異なるオプションで生成された)を使用する機能。

どんなアイデアでも大歓迎です!

乾杯、

思考。

4

2 に答える 2

1

OK, I think I've actually come up with an answer to my own question.

Firstly, I generate two tags files: tags_c_vim and tags_c_omni.

In my _vimrc I have:

let tags_vim='tags_c_vim'
let tags_omni='tags_c_omni'

exe "set tags=".tags_vim

to setup some variables pointing to the different tags files, and to set the "vim" tags to be the default tags.

Then I also have this, again in the _vimrc:

imap <F8> <ESC>:exe "set tags=".tags_omni<CR>a<C-X><C-O>
autocmd InsertLeave * if pumvisible() == 0|exe "set tags=".tags_vim|endif

the first line here maps F8 so it changes the tags setting to point to the "omni" tags before then invoking the omnicomplete popup menu, and the second line resets the tags setting to the "vim" tags when insert mode is next left after the popup has closed.

It's going to need some extensive use to make sure it's robust enough, but it does seem to work after some quick testing.

Two improvements I'd still like to make:

  1. Map the setting of the "omni" tags to the omnicomplete C-X,C-O command instead of a new F8 mapping. (I think I need to set the tags and then call omni#cpp#maycomplete#Complete(), but I couldn't work out how to do this)
  2. Hook the resetting of the "vim" tags into either omnicomplete itself finishing or the popup menu closing

Anyway, I just thought I'd share.

Cheers,

thoughton.

于 2010-02-12T16:57:19.107 に答える
0

You could try the OmniCppComplete plugin.

于 2010-02-11T19:08:46.443 に答える