When I click the file I want to open in Sublime, it is replacing the current tab I have open. It used to open it in a new tab.
7 Answers
This is because you were only previewing the previous file. If you click on a file once in the sidebar, by default it opens in preview mode. Clicking another file will open it in preview mode, in the same tab. You can disable this behavior by double-clicking the file in the sidebar, by beginning to edit the file, or via the user settings: select Preferences -> Settings-User
and add
"preview_on_click": false,
then save the file. With this new behavior, you will need to double-click on a file in the sidebar to open it, and it will not close if you double-click another file.
-
2Adding that didn't help. It disabled opening up the file and "previewing" it completely.– Mark AJun 18, 2016 at 16:37
-
3@MarkA that's exactly what I said in my answer. You can either have
"preview_on_click": true
where single-clicking a file in the sidebar opens that file in preview mode, and single-clicking on another file replaces the first file with the second. If you want to keep a previewed file open, you need to double-click it, then the next single-clicked file will open in a new preview tab. Alternatively, setting"preview_on_click": false
disables preview tabs altogether, and you must double-click on a file to open it.– MattDMoJun 18, 2016 at 16:42 -
19
-
It seems to be the default in my sublime version to open a file with double click in a new tab. I have stable channel Build 4126.– TimoMar 1, 2022 at 22:04
Preferences -> Settings-User -> "open_files_in_new_window": false
-
I think that this directive is only available on MacOS. Any viable solution for Linux? Adding
-n
sort of works, but opens a new folder in the same tab, rather than a new one. Nov 8, 2018 at 19:13
Open Registry Editor
(The easiest way to do this in all versions of Windows is to open the Run dialog box via WIN+R
, and enter regedit
)
go to :
Computer\HKEY_CLASSES_ROOT\Applications\sublime_text.exe\shell\open\command
change it from :
"C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"
to :
"C:\Program Files\Sublime Text 3\sublime_text.exe" -n "%1"
You can use a simple python script to get files to open in a new tab with a single click.
import sublime
import sublime_plugin
import os
class NoPreview(sublime_plugin.EventListener):
def on_load(self, view):
if (os.path.exists(view.file_name())):
view.run_command('save')
Save this script with a .py extension in your sublime packages directory.
(Usually ~/.config/sublime-text-3/Packages/User
in Linux)
Note: Make sure "preview_on_click"
is set to true
in Preferences > Settings, otherwise this will not work.
-
1This works great. Makes it more like VScode. In Windows the path is: C:\Users\{username here}\AppData\Roaming\Sublime Text 3\Packages– MarcusSep 1, 2022 at 17:58
You can simply go to preferences/settings/preferences.sublime_setting.
Under this, after font-size(array), paste this "preview_on_click": false
.
And you are done!
Note: After this, you have to double click to open any file.
On single click you preview the files. You can double click on the file to open them in a new tab.
You must be having "show tabs" unchecked under the VIEW tab. Check it and you can open a file with a double click.
-
Not sure why this has been marked down. It is one of the reason that sublime text does not show tabs.– menrfaMar 13, 2022 at 12:17