Mark A
Mark A

Reputation: 2125

How do you make Sublime Text 3 open a file in a new tab instead of opening it in the current tab?

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.

Upvotes: 79

Views: 41508

Answers (7)

Shah rukh
Shah rukh

Reputation: 21

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.

Upvotes: 2

Sanket Kumbhare
Sanket Kumbhare

Reputation: 33

On single click you preview the files. You can double click on the file to open them in a new tab.

Upvotes: 2

Kartik Shah
Kartik Shah

Reputation: 182

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.

Upvotes: 2

tejas n
tejas n

Reputation: 728

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"

Upvotes: 4

Chirag Pandey
Chirag Pandey

Reputation: 65

You must be having "show tabs" unchecked under the VIEW tab. Check it and you can open a file with a double click.

Upvotes: -2

user2939562
user2939562

Reputation:

Preferences -> Settings-User -> "open_files_in_new_window": false

Upvotes: 46

MattDMo
MattDMo

Reputation: 102852

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.

Upvotes: 91

Related Questions