Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merged pull request from buhrmi. Adds searching of external tags file…

…s. Changes to use hidden tags files.
  • Loading branch information...
commit bb6070b22e0dca5a77d418f8d13d7105234a6b81 2 parents 1db1205 + 78cc7e9
Greg Williams authored
Showing with 25 additions and 9 deletions.
  1. +3 −2 CTags.sublime-settings
  2. +7 −4 README.creole
  3. +15 −3 ctagsplugin.py
View
5 CTags.sublime-settings
@@ -1,6 +1,6 @@
{
"debug" : false,
- "ctags_command" : "ctags -R",
+ "ctags_command" : "ctags -R -f .tags",
"filters" : {
"source.python": {"type":"^i$"}
},
@@ -9,5 +9,6 @@
},
"definition_current_first": true,
"show_context_menus": false,
- "extra_tag_paths" : [ [["source.python", "windows"], "C:\\Python27\\Lib\\tags"]]
+ "extra_tag_paths" : [ [["source.python", "windows"], "C:\\Python27\\Lib\\tags"]],
+ "extra_tag_files" : [".gemtags"]
}
View
11 README.creole
@@ -3,7 +3,7 @@
This [[http://sublimetext.com|Sublime Text 2]] Package provides support for working with tags generated by [[http://ctags.sourceforge.net/|Exuberant CTags]]
The ctags command is searched for on PATH. It works by doing a binary search of
-an mmap()'d `tags` file so it will work efficiently with very large ( 50MB+ etc
+an mmap()'d `.tags` file so it will work efficiently with very large ( 50MB+ etc
) tags files if needed.
== Exuberant Tags ==
@@ -62,7 +62,7 @@ See this [[http://www.sublimetext.com/forum/viewtopic.php?f=5&t=144|forum thread
=== Usage ===
-This uses `tags` files created in `ctags -R` recursive mode.
+This uses `.tags` files created in `ctags -R -f .tags` recursive mode.
The commands will try and find a `tags` file in the same directory as
the current view, walking up directories until it finds one. If it
@@ -89,7 +89,7 @@ There's a CTags.sublime-settings file:
{{{
{
"debug" : false,
- "ctags_command" : "ctags -R",
+ "ctags_command" : "ctags -R -f .tags",
"filters" : {
"source.python": {"type":"^i$"}
},
@@ -98,7 +98,8 @@ There's a CTags.sublime-settings file:
},
"definition_current_first": false,
"show_context_menus": false,
- "extra_tag_paths" : [ [["source.python", "windows"], "C:\\Python27\\Lib\\tags"]]
+ "extra_tag_paths" : [ [["source.python", "windows"], "C:\\Python27\\Lib\\tags"]],
+ "extra_tag_files" : [".gemtags"]
}
}}}
@@ -116,6 +117,8 @@ tag. In the excerpt above, imports tags like "from a import b" are filtered.
`extra_tag_paths` is a list of extra places to look for keyed by (selector, platform)
+`extra_tag_files` is a list of extra files relative to the original .tags file
+
Note the platform (`windows` in the example above) is tested against
`sublime.platform()` so any values that function returns are valid.
View
18 ctagsplugin.py
@@ -140,7 +140,7 @@ def find_tags_relative_to(view):
fn = view.file_name()
if not fn: return ''
- dirs = normpath(join(dirname(fn), 'tags')).split(os.path.sep)
+ dirs = normpath(join(dirname(fn), '.tags')).split(os.path.sep)
f = dirs.pop()
while dirs:
@@ -165,6 +165,18 @@ def alternate_tags_paths(view, tags_file):
except Exception, e:
print e
+ if os.path.exists(tags_paths):
+ for extrafile in setting('extra_tag_files'):
+ search_paths.append(normpath(join(dirname(tags_file), extrafile)))
+
+
+ # Ok, didn't found the .tags file under the viewed file.
+ # Let's look in the currently openened folder
+ for folder in view.window().folders():
+ search_paths.append(normpath(join(folder, '.tags')))
+ for extrafile in setting('extra_tag_files'):
+ search_paths.append(normpath(join(folder, extrafile)))
+
return [p for p in search_paths if p and os.path.exists(p)]
################################# SCROLL TO TAG ################################
@@ -532,8 +544,8 @@ def run(self, edit, **args):
base_path = view.window().folders()[0]
else:
base_path = dirname(view_fn(view))
- tag_file = join(base_path, 'tags')
-
+ tag_file = join(base_path, '.tags')
+
if 0: #not 1 or sublime.question_box('`ctags -R` in %s ?'% dirname(tag_file)):
return
Please sign in to comment.
Something went wrong with that request. Please try again.