+3

Allow setting which keys commit auto complete

Joel Thornton 13 years ago updated 13 years ago 3

Currently auto completes can be committed by pressing Enter and/or Tab, depending on the "auto_complete_commit_on_tab" setting. Expand this by adding a "auto_complete_commit_trigger_characters" setting which allows the user to specify which characters act as auto complete commit triggers. 


For instance if working with Python I might like to set it as:

"auto_complete_commit_trigger_characters": [".", " ", "Tab"]


.. and use Esc when I want to cancel auto complete. 


A similar option is found in Eclipse, where it gives the user a nice, fine-grained control over how "aggressive" the auto complete behavior is. In particular, allowing non-alphanumeric characters such as ".", ">", and " " to trigger auto complete commit can noticeably increase coding efficiency in some circumstances.


For consistency it might make more sense to call it "auto_complete_commit_triggers" and conform it to the same values pattern that "auto_complete_triggers" already uses. I would think that we could just put different values for "auto_complete_commit_trigger_characters" in <filetype>.sublime-settings files equally as well though.
+3

This is already possible.  Just open up your user keybindings and add:

{ "keys": ["YOUR_KEY_HERE"], "command": "commit_completion", "context":[{ "key": "auto_complete_visible" },{ "key": "setting.auto_complete_commit_on_tab", "operand": false }]}

If you want to make it filetype specific, you can just add a selector to the context...

Thanks for the tip.

I have also found the SublimeCodeIntel plugin to do this and more.