Permalink
Browse files

Disable autocomplete by default

  • Loading branch information...
1 parent 03223f2 commit 18f3486187d918b9401dbc0ac02bbac0b35e6e13 @cweagans cweagans committed Dec 18, 2012
Showing with 12 additions and 10 deletions.
  1. +1 −0 CTags.sublime-settings
  2. +11 −10 ctagsplugin.py
@@ -11,6 +11,7 @@
// in this file and in your user settings.
"debug" : false,
+ "autocomplete": false,
"command" : "ctags -R -f .tags",
"filters" : {
"source.python": {"type":"^i$"}
View
@@ -676,17 +676,18 @@ def tags_built(tag_file):
class CTagsAutoComplete(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
- tags_path = view.window().folders()[0]+"/.tags"
- results=[]
- if (not view.window().folders() or not os.path.exists(tags_path)): #check if a project is open and the .tags file exists
+ if setting('autocomplete'):
+ tags_path = view.window().folders()[0]+"/.tags"
+ results=[]
+ if (not view.window().folders() or not os.path.exists(tags_path)): #check if a project is open and the .tags file exists
+ return results
+ f=os.popen("grep -i '^"+prefix+"' '"+tags_path+"' | awk '{ print $1 }'") # grep tags from project directory .tags file
+ for i in f.readlines():
+ results.append([i.strip()])
+ results = [(item,item) for sublist in results for item in sublist] #flatten
+ results = list(set(results)) # make unique
+ results.sort() # sort
return results
- f=os.popen("grep -i '^"+prefix+"' '"+tags_path+"' | awk '{ print $1 }'") # grep tags from project directory .tags file
- for i in f.readlines():
- results.append([i.strip()])
- results = [(item,item) for sublist in results for item in sublist] #flatten
- results = list(set(results)) # make unique
- results.sort() # sort
- return results
##################################### TEST #####################################

0 comments on commit 18f3486

Please sign in to comment.