2009-09-24 31 views

回答

3

Exuberant ctags已經支持Erlang的tag field「模塊」。

$ /usr/bin/ctags --version 
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert 
    Compiled: Aug 17 2010, 17:33:33 
    Addresses: <[email protected]>, http://ctags.sourceforge.net 
    Optional compiled features: +wildcards, +regex 
$ /usr/bin/ctags xref_parser.erl 

名爲「模塊」標籤領域的一個典型的標記線是這樣的:

yeccgoto_const xref_parser.erl /^yeccgoto_const(24=_S, Cat, Ss, Stack, T, Ts, Tzr) ->$/;"  f  module:xref_parser 

其實,這是VIM不支持此標記字段現在。從VIM doc

{field} .. A list of optional fields. Each field has the form: 

      <Tab>{fieldname}:{value} 

     The {fieldname} identifies the field, and can only contain 
     alphabetical characters [a-zA-Z]. 
     The {value} is any string, but cannot contain a <Tab>. 

     There is one field that doesn't have a ':'. This is the kind 
     of the tag. It is handled like it was preceded with "kind:". 
     See the documentation of ctags for the kinds it produces. 

     The only other field currently recognized by Vim is "file:" 
     (with an empty value). It is used for a static tag. 

就是這樣。只有「kind」和「file」支持標籤字段名稱。

+0

該工具以Vim可以使用的方式爲Erlang文件生成模塊:函數標籤:https://github.com/vim-erlang/vim-erlang-tags – hcs42 2013-07-05 11:54:19

1

這聽起來像你沒有使用Erlang etags模塊:Generate Emacs TAGS file from Erlang source files

+0

etags是用於Emacs的,我使用Vim。 – hcs42 2013-03-14 13:38:05

+0

更正:當使用+ emacs_tags特性編譯時,Vim也可以使用etags。但etags似乎也不支持模塊限定符。 – hcs42 2013-04-19 12:06:07

0

我是一個崇高的2文本用戶,並發現ctags在我的電腦中正常工作。我用ctags plugin爲崇高2.


- > C標籤--version

Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert 
Compiled: Jul 24 2012, 11:45:55 
Addresses: <[email protected]>, http://ctags.sourceforge.net 
Optional compiled features: +wildcards, +regex 
3

像LHT寫道,旺盛Ctags的5.8已經存儲在標籤文件的功能模塊。至少在Vim(7.4)的最新版本中,可以訪問這些信息。然後可以使用自定義的「標記」功能來查找「module:function」,例如:

function! ErlangTag() 
    let isk_orig = &isk 
    set isk+=: 
    let keyword = expand('<cword>') 
    let &isk = isk_orig 
    let parts = split(keyword, ':') 
    if len(parts) == 1 
     execute 'tag' parts[0] 
    elseif len(parts) == 2 
     let [mod, fun] = parts 
     let i = 1 
     let fun_taglist = taglist('^' . fun . '$') 
     for item in fun_taglist 
      if item.kind == 'f' && item.module == mod 
       silent execute i . 'tag' fnameescape(item.name) 
       break 
      endif 
      let i += 1 
     endfor 
    endif 
endfunction 

nnoremap <buffer> <c-]> :call ErlangTag()<cr> 
相關問題