5
votes

I'm using the Sublime Text 3 with Ruby On Rails projects.

Some time ago, I setup CTags using this tutorial.

It was fine, but suddenly stopped to work. I'm getting the following error when try to rebuild the tags of project.

/bin/sh: ctags_for_ruby: command not found

These are my files:

/usr/local/bin/ctags_for_ruby:

#!/usr/bin/env ruby
system "find . -name '*.rb' | ctags -f .tags -L -"

if File.exist? './Gemfile'
  require 'bundler'
  paths = Bundler.load.specs.map(&:full_gem_path).join(' ')
  system "ctags -R -f .gemtags #{paths}"
end

~/Library/Application Support/Sublime Text 3/Packages/User/CTags.sublime-settings

{
    "debug"           :  false,
    "autocomplete": false,
    "command"   :  "ctags_for_ruby",
    "filters"         :  {
        "source.python": {"type":"^i$"}
    },
    "definition_filters": {
        "source.php": {"type":"^v$"}
    },
    "definition_current_first": true,
    "show_context_menus": true,
    "extra_tag_paths" :  [ [["source.python", "windows"], "C:\\Python27\\Lib\\tags"]],
    "extra_tag_files" : [".gemtags", ".tags"]
}

And the $PATH variable includes /usr/local/bin directory.

Why Sublime can't find/execute the ctags_for_ruby file?

1
Have you installed package control yet?Marco Prins
Yes, @MarcoPrins, as said, the installation was working and stoppedRodrigo
@rodrigo ST3 comes with "go to definition" feature, are there any other specific advantages of still using Ctags in ST3 that I'm missing? If yes, kindly elaborate. Thank you.boddhisattva
I don't think that "go to definition" knows anything about your gems @boddhisattvaLinus

1 Answers

3
votes

/usr/local/bin may be in your shell's $PATH, but it is not getting picked up by Sublime. To fix this, edit ~/Library/Application Support/Sublime Text 3/Packages/User/CTags.sublime-settings and change the "command" setting to "/usr/local/bin/ctags_for_ruby". Also, unless you are using the system Ruby in /usr/bin, you might want to edit the first line of /usr/local/bin/ctags_for_ruby from #/usr/bin/env ruby to the direct path of your Ruby interpreter - you can find this by running which ruby on the command line.