+7

single click behavior on file in "Side Bar"

Parrish 12 aastat tagasi uuendaja Sahil Rajput 3 aastat tagasi 9
When sigle-clicking on a file in the "Side Bar" the file opens for preview?  Unfortunately, the visual queues for this action are confusing... a file is viewed in the editor without a tab, yet the first edit to the file creates a new tab for the file.  It would be nice to have some other visual queue to accomplish this... i.e. a window that hovers over the edit window, with an edit button on it; gray out all tabs when previewing a file, with a click on a tab closing the preview and selecting the tab; or simply have a setting to allow a single click to do nothing.
Against, or at least should be configurable. I enjoy the "preview" mode immensely, and use it constantly — it is often useful to glance over a file without it polluting the tab bar, and if any change is needed the transition from "preview" to "editing" is very unobtrusive.
+1
It would be great to be able to configure this as an option. The biggest problem I have with the single-click preview is that if you have multiple documents open in tabs, then go to right-click on a file in the Side Bar, the focused tab is lost so you have to then locate the document you were previously working on again. It's not a problem with only 2-3 files open, but when you're jumping between 7+ it's annoying to lose that tab focus constantly when you're just trying to copy a file name or directory structure.

Isn’t this controlled by this setting nowadays?

 // Preview file contents when clicking on a file in the side bar. Double

  // clicking or editing the preview will open the file and assign it a tab.

  "preview_on_click": true,


+10

Would be nice if this existing setting could be used for it:

// Preview file contents when clicking on a file in the side bar. Double

  // clicking or editing the preview will open the file and assign it a tab.

  "preview_on_click": true

When set to false, it could enable the single-click-opens-the-file behavior.

"preview_on_click": false

just disables the preview, still have to double click to open the file to open it

+3

Spent 4 hours trying to fix this stupid behavior on ST3 and finally got a plugin working...

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 file in the User Packages directory (~/.config/sublime-text-3/Packages/User/ on Linux). Keep the setting preview_on_click set to true: when a "previewed" file is saved, it becomes a "regular" file. That's all...
Note that it's necessary to check that the file actually exists, because some "files" loaded are not actual files (like default settings, for example).

Thank you Arcesilas, exactly what I was looking for!

Amazing that worked like a charm, but i didn't know that i had to save that file as NoPreview.py name in that directory.

Yikes!!!!!

Thanks a lot!!!!

Hi,

I am a new learner, can you tell me to save that code to ST3 package?

I tried but had error.

I am working on Windows 10.

Thanks.