Sublime Forum

Disable auto creating tabs?

#1

when i double click a file to open it, i want it to open in a new Window instead of a new tab of a prexisting window. how do i do that?

0 Likes

#2

I am not sure if it’s possible to modify the behavior of the double click like that but if you don’t mind right clicking the file in the sidebar & selecting an option to do your task, you can still achieve it if you don’t mind a bit of plugin code.

import sublime
import sublime_plugin

class OpenFileNewWindowCommand(sublime_plugin.WindowCommand):

	def run(self, paths):
		sublime.run_command("new_window")
		sublime.active_window().open_file(paths[0])

Save this as a python file of any name in User (Preferences -> Browse Packages ... from main menu to get to User). Create a Side Bar.sublime-menu file (the name matters. Make sure to get it exactly right) and paste the following :-

[
	{
		"caption": "New Window",
		"command": "open_file_new_window",
		"args": {
			"paths": []
		},
	}
]

Now when you right click a file, this option New Window should show up in the context menu and clicking it will open the file in a new window.

0 Likes