Sublime Forum

Mouse side buttons to go back to last opened tab

#1

I’m pretty sure this should be possible. The default behaviour is that the mouse4/mouse5 buttons cycle the open tabs left to right. In a web browser these act as back/forward I want similar behaviour in Sublime.

Is it possible to cycle between tabs in the order they were last visible? So for example if I have tabs 1,2,3,4,5 and I’m on 4, then go to 1 and click mouse4 it goes “back” to tab 4, then press mouse5 and it goes “forward” to tab 1?

0 Likes

#2

Yes, it is possible. In Sublime Text, the .sublime-mousemap files can be used to configure mouse based behaviors.

Based on your OS, create a Default ($platform).sublime-mousemap file in your User directory. Here $platform can be Windows, Linux or OSX depending on your OS.

Paste the following in it.

[
    // Switch files in visited history with buttons 4 and 5
    { "button": "button4", "modifiers": [], "command": "prev_view_in_stack" },
    { "button": "button5", "modifiers": [], "command": "next_view_in_stack" },
]

Buttons button4 & button5 should now be configured to switch tabs based on visited history rather than the original behavior of switching in a linear fashion.

I don’t have a mouse with that many buttons, so I can’t test this out, unfortunately.

1 Like