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

后端 未结 5 1680
时光取名叫无心
时光取名叫无心 2020-12-13 01:59

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.

相关标签:
5条回答
  • 2020-12-13 02:15

    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

    0 讨论(0)
  • 2020-12-13 02:31

    https://github.com/sobstel/SyncedSideBar

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

    0 讨论(0)
  • 2020-12-13 02:33

    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

    0 讨论(0)
  • 2020-12-13 02:39

    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!

    0 讨论(0)
  • 2020-12-13 02:41

    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.

    0 讨论(0)
提交回复
热议问题