Skip to content

Instantly share code, notes, and snippets.

@ianstarz
Last active January 1, 2016 11:49
Show Gist options
  • Save ianstarz/8140727 to your computer and use it in GitHub Desktop.
Save ianstarz/8140727 to your computer and use it in GitHub Desktop.
A custom command for Sublime Text 2 that is shortcut-able and switches the position of the active tab by moving it forward or back one tab position. For the ocd coders out there that like to maintain a particular tab order without leaving the keyboard. Place the MoveTabCommand.py into your "~/Library/Application Support/Sublime Text 2/Packages/U…
import sublime, sublime_plugin
class MoveTabCommand(sublime_plugin.WindowCommand):
def run(self, mod):
view = self.window.active_view()
group_index, tab_index = self.window.get_view_index(view)
self.window.set_view_index(view, group_index,
(tab_index + int(mod)) % len (
self.window.views_in_group(group_index)) )
self.window.focus_view(view)
# Place the following shortcuts into your user keyboard shurtcuts
# { "keys": ["super+ctrl+shift+]"], "command": "move_tab", "args": {"mod": 1} },
# { "keys": ["super+ctrl+shift+["], "command": "move_tab", "args": {"mod": -1} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment