Sublime Forum

Two questions about the sidebar

#1

Hi guys & girls,

I’m new to Sublime Text (coming from Atom) and trying to configure it to my workflow. I have 2 issues/questions that i hope the community here can help me with.

  1. I want to open/close the sidebar with CTRL+CIRCUMFLEX (it’s the key under ESC on the german keyboard). In the user-keybindings I can’t type-in the key because on the first press it’s empty, and on the second press it gives ^^ (a double accent). I tried the keyname “circumflex”, but it doesn’t work. How can i bind that key?

  2. I don’t have a tree-view in the sidebar, only the open tabs. And there are no icons showing, although i have “A File Icon” installed. Do i need to activate the tree-view somehow?

0 Likes

#2
  1. The keyword internationalization in Sublime Text does not work so well. If you want to create a keybinding just open the console View > Show Console… (ctrl+ö on german+windows) and write sublime.log_input(True) and press the keybinding and look at the console. On windows it should be:
    {
        "keys": ["ctrl+\\"],
        "command": "toggle_side_bar",
    },
  1. Have you opened a folder in Sublime Text? You can just drag a folder from your file explorer into Sublime Text.
1 Like

#3

r-stein, thank you very much! I’m used to having to use the english kbd layout in many apps.
Ctrl+Ö will come in handy, didn’t know that one. Interesting that you have to do double-backslash in the bindings, the log reported single-backslash (JSON syntax i suppose).

Oh, and the sidebar handling seems to differ from Atom, which opened folders automatically with the file. I find the handling of Sublime much better, since i use such an editor for everyday tasks as well (quick open of some txt notes).

0 Likes

#4

Oh, and the sidebar handling seems to differ from Atom, which opened folders automatically with the file.

Isn’t this an Atom package?

Let’s see if we can replicate this behavior. There is a built-in command1 called reveal_in_side_bar that will, as the name suggests, reveal the current view in the sidebar. We want to trigger this command whenever a new view activates. The following six-liner already seems to do the job:

import sublime_plugin

class AutoReveal(sublime_plugin.ViewEventListener):
    
    def on_activated(self):
        self.view.window().run_command('reveal_in_side_bar', args={'paths': []})

Click on Tools -> Developer -> New Plugin and save the above snippet as AutoReveal.py. in the Packages/User directory. You should start to see Sublime opening the currently active view in the sidebar.

1: More precisely, there are built-in commands and commands from the Default package, and commands from installed/foreign plugins. This one is a built-in command. The difference is of no importance.

1 Like

#5

Regarding your first question, maybe one of these packages works for you instead?

0 Likes

#6

Guys, thanks a bunch! I think it’s my fault that i didn’t explicitly wrote that i have solved the issues / questions after r-stein’s reply.

Sorry for not being clear. But maybe the other solutions will help some other soul out there. :slight_smile:

0 Likes