How to use sidebar with the keyboard in Sublime Text 2 and 3?

前端 未结 13 1188
我寻月下人不归
我寻月下人不归 2021-01-29 17:57

When using Sublime Text 2 we tend to open the side bar to navigate thru files/folders in our projects. For that we can use the hotkey ctrl+k ctrl+b (i

相关标签:
13条回答
  • 2021-01-29 18:39

    I didn't find any other complete answers, so I pulled together information from various answers and added a bit of my own.

    • Ctrl+K, Ctrl+B: toggle the sidebar
    • Ctrl+K+B: shorted form of the above (make sure you hit K and B in the right order)
    • Ctrl+0: switch focus to the sidebar (if open)
    • Up/Down: navigate file list
    • Right: expand a directory
    • Left: collapse a directory/navigate to parent directory
    • Enter: open a file

    @Santiago Agüero The part you were missing was that the sidebar needs focus before the arrow keys will work (Ctrl+0).

    As far as I can know, these shortcuts all work in Sublime 3, as well as Sublime 2.

    One caveat: these assume you are using the default keybindings. But you can easily customize the keybindings by opening Preferences > Key Bindings - User and copying over lines from Preferences > Key Bindings - Default, changing the keys value as needed. E.g.,

    { "keys": ["ctrl+k", "ctrl+b"], "command": "toggle_side_bar" },
    { "keys": ["ctrl+0"], "command": "focus_side_bar" },
    

    P.S. To get the fancy-looking keyboard glyphs, use the <kbd> HTML tag. E.g., <kbd>Key</kbd> will turn into Key. (Thanks to https://meta.stackexchange.com/questions/5527) :)

    0 讨论(0)
  • 2021-01-29 18:41

    For Sublime Text 2 (and also Sublime Text 3) on Windows use Ctrl+0 to focus on the side bar, and use Ctrl+1 or Esc key to focus on the editor. And if it didn't work, use those 0 and 1 keys that exist in the numeric keys row under the function keys row rather than those 0 and 1 keys that exist in the numeric keypad of the keyboard. This image may demonstrate better: http://en.wikipedia.org/wiki/File:Qwerty.svg

    0 讨论(0)
  • 2021-01-29 18:41

    Ctrl + 0 will focus on the side bar.
    Ctrl + 1 will focus on the editor in the 1st window.
    Ctrl + 2 will focus on the editor in the 2nd window etc.
    Sandeep made a great post about improving the keyboard shortcut toggling side bar on/off.
    Go to Preference->Key Binding and enter:

    [
        { "keys": ["ctrl+\\"], "command": "toggle_side_bar" },
    ]
    

    save it and then press "ctrl+\" to toggle the sidebar.

    In Linux new keybindings are saved in ~/.config/sublime-text-3/Packages/User/'Default (Linux).sublime-keymap'.

    0 讨论(0)
  • 2021-01-29 18:42

    Another useful shortcut: ctrl + k Together with ctrl + b will show/hide the sidebar. Make sure you hit K and B in the right order

    0 讨论(0)
  • 2021-01-29 18:43

    You have to add a folder to the Sublime Text window in order to navigate via the sidebar. Go to File -> Open Folder... and select the highest directory you want to be able to navigate.

    0 讨论(0)
  • 2021-01-29 18:44

    enter this shortcode on Preference->Key Binding

    [
        { "keys": ["ctrl+\\"], "command": "toggle_side_bar" },
    ]
    

    now save it press "ctrl+\\" for toggle the sidebar

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