Sublime Text 2 - Link with Editor / Show file in sidebar

Sublimetext

Sublimetext Problem Overview


I'm looking for a feature like Eclipse's Link with Editor. Basically, I want whatever file I'm editing to be shown in its place in the file tree.

Sublimetext Solutions


Solution 1 - Sublimetext

Just right-click anywhere in the file's view and press "Reveal in Sidebar."

Sublime Text 2: built-in

To make a key-binding, go to Preferences > Key Bindings-User and add:

{ "keys": ["ctrl+shift+r"], "command": "reveal_in_side_bar" }

From here.

Solution 2 - Sublimetext

https://github.com/sobstel/SyncedSideBar

You can install this via the Package Control utility (although it doesn't mention it on the github page).

Solution 3 - Sublimetext

There is a simpler option to automate this: Create a new Plugin:

Menu Tools->New pluguin and save this:

import sublime, sublime_plugin

class SideBarListener(sublime_plugin.EventListener):
    
    def on_activated(self, view):
        view.window().run_command('reveal_in_side_bar')

The folder where to save this is selected by default, and extension (.py) also is added by default.

On windows, the folder is C:\Users\username\AppData\Roaming\Sublime Text 2\Packages\User

That's quite usefull to modify a saved pluggin

Solution 4 - Sublimetext

I know I'm quite late for the party here, but having the very same need and trying to avoid mouse commands I've wrote a new plugin to that, take a look and give it a try, anything please feel free to ping me =)

https://github.com/miguelgraz/FocusFileOnSidebar

Solution 5 - Sublimetext

I tested the solution proposed by Albert Català, but it causes an error when a popup window appears, with the 'Quick Switch Projects' command for example.

So here is my modified version to avoid errors :

import sublime
import sublime_plugin

class LinkWithEditor(sublime_plugin.EventListener):

    def on_activated(self, view):
        if view.window() is not None:
            view.window().run_command('reveal_in_side_bar')

Hope this help!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionnoahView Question on Stackoverflow
Solution 1 - SublimetextLiam CainView Answer on Stackoverflow
Solution 2 - SublimetextJeremy HalliwellView Answer on Stackoverflow
Solution 3 - SublimetextAlbert CatalàView Answer on Stackoverflow
Solution 4 - SublimetextMiguelgrazView Answer on Stackoverflow
Solution 5 - SublimetextPascalWView Answer on Stackoverflow