Vim ctags没有索引我想要的所有单词
我正在尝试用ctags为我的rails应用程序编制索引,以便vim可以给我自动完成功能。 然而,ctags并没有索引所有的单词,尤其是我对外部库的调用。 例如: 我有这个档案:Vim ctags没有索引我想要的所有单词,vim,ctags,Vim,Ctags,我正在尝试用ctags为我的rails应用程序编制索引,以便vim可以给我自动完成功能。 然而,ctags并没有索引所有的单词,尤其是我对外部库的调用。 例如: 我有这个档案: class MultipleChoice < ActiveRecord::Base has_many :options, :class_name => 'MultipleChoiceOption', :foreign_key => :parent_id, :dependent => :dest
class MultipleChoice < ActiveRecord::Base
has_many :options, :class_name => 'MultipleChoiceOption', :foreign_key => :parent_id, :dependent => :destroy
accepts_nested_attributes_for :options, :allow_destroy => true
def question
Question.find_by_data_id_and_data_type(id, MultipleChoice.name)
end
def randomized_options
(0...options.size).to_a.shuffle.map{|index| [index, options[index]]}
end
def realized_answer(user_answer)
user_answer.blank? ? nil : options[user_answer.to_i].content
end
def answer
options.detect{|o| o.correct}.content
rescue => e
HoptoadNotifier.notify(
:error_class => "MultipleChoice",
:error_message => "Exception while call #answer: #{e.message}",
:parameters => {:multiple_choice_id => self.id}
)
nil
end
end
class MultipleChoice'multiplechiceoption',:foreign\u key=>:parent\u id,:dependent=>:destroy
接受\u嵌套的\u属性\u for:options,:allow\u destroy=>true
定义问题
问题.按数据id和数据类型(id,MultipleChoice.name)查找
结束
def\u选项
(0…options.size).to_a.shuffle.map{| index |[index,options[index]}
结束
def实现的用户应答(用户应答)
用户回答。空白?无:选项[user\u answer.to\u i]。内容
结束
def答案
选项。检测{o|o.correct}.content
救援=>e
HoptoadNotifier.notify(
:error_class=>“MultipleChoice”,
:error_message=>“调用时异常#应答:#{e.message}”,
:parameters=>{:multiple\u choice\u id=>self.id}
)
无
结束
结束
然后CTAG将索引MultipleChoice(类名)、answer(方法名),但不索引HoptoadNotifier
我正在使用ctags-R*
有没有办法告诉CTAG将它们全部编入索引?首先,确保您的rails应用程序目录中的某个地方有HoptoadNotifier源。那么,让我们假设您的目录中有:
/railsapp/vendor/plugins/hoptoad_notifier/lib
这将是HoptoadNotifier源的存储位置
然后运行以下命令:
cd /railsapp
ctags -R --tag-relative=yes
这将在railsapp/called标记中创建一个文件,并包含HoptoadNotifier模块的标记信息
我知道这或多或少是您已经做过的,所以我只能假设HoptoadNotifier源不在您的目录结构中,因为我在我的机器上重新创建了它,它工作得非常好。您还可以使用“-V”来运行CTAG,以吐出所有调试信息及其执行的操作