升华文本2-链接编辑器/显示文件在侧边栏

我正在寻找一个特性,比如 Eclipse 的 Link with Editor。基本上,我希望我正在编辑的任何文件都能在文件树中显示出来。

27631 次浏览

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

Sublime Text 2: built-in "reveal in Side Bar" feature

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

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

From here.

https://github.com/sobstel/SyncedSideBar

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

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

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

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!