Best solution: use auto_complete_cycle parameters (added March 26, 2015):
Please use this new easy solution, not the python plugin
The new version of Sublime Text released on March 24, 2015 has a new parameter called auto_complete_cycle that implements this behavior. Set to true to repeat autocomplete results.
"auto_complete_cycle": true
Worst old solution: this custom plugin
I just made this plugin that works well on Sublime Text 3 in Linux Mint. I have not tested it in Sublime Text 2, but I think the plugin system is the same, so it should work on this version too. The workaround used it is not too pretty, but it works.
import sublime, sublime_plugin class UpArrowInAutoCompleteCommand(sublime_plugin.TextCommand): def run(self, edit): self.view.settings().set('autoCompleteFlag',True) self.view.settings().set('initialPoint', self.view.sel()[0].begin()) """ Move one line up """ self.view.run_command('move', {"by": "lines", "forward": False}); """ Auto-complete was opened and up arrow was pressed, so if the cursor changes (on_selection_modified will be triggered) we have gone outside the list. If we were not in the first element on_selection_modified will not be triggered, so we turn of the flag""" sublime.set_timeout(lambda: self.view.settings().set('autoCompleteFlag', False),300) class AutoCompleteSelectionModifiedTriggerCommand(sublime_plugin.EventListener): def on_selection_modified(self, view): if view.settings().get('autoCompleteFlag'): """ If the up arrow was pressed and on_selection_modified has been triggered, then we know that we were in the first element of the list and we hitted the up arrow""" view.settings().set('autoCompleteFlag', False) initialPoint = view.settings().get('initialPoint') """ We don't know how many words the auto_complete has, so, in order to calculate that number, we move down in the list till we get outside the list. After that we make the list appear again and move down n-1 times to go (and stay) to the last line """ view.sel().clear() view.sel().add(initialPoint) view.run_command('auto_complete') numLines = 0 while view.sel()[0].begin() == initialPoint: view.run_command('move', {"by": "lines", "forward": True}) numLines += 1 if numLines == 401: return if numLines == 0: return view.sel().clear() view.sel().add(initialPoint) view.run_command('auto_complete') numLine = 0 while numLine < (numLines-1): view.run_command('move', {"by": "lines", "forward": True}) numLine += 1
So that the plugin uses Tools> the new plugin and inserts the code. Then save it in the Packages / User folder. You can use Settings> Browse Packages to find the Packages box, inside which the userโs folder is located.
To do this, I added these bindings to my user key bindings file (the second is your own binding):
{ "keys": ["up"], "command": "up_arrow_in_auto_complete", "context": [{ "key": "auto_complete_visible", "operator": "equal", "operand": true }] }, { "keys": ["down"], "command": "auto_complete", "context": [{ "key": "auto_complete_visible" }] }
Edit: this is an example result:
