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

前端 未结 13 1186
我寻月下人不归
我寻月下人不归 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:30

    You can type Ctrl+0 (Ctrl+Zero) to focus on the side bar.

    Then you'll be able to move selection among files with arrow keys and to open the selected file hitting Enter, without touching the mouse.

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

    Summary

    Ctrl + 0 will navigate to your sidebar. By default you can navigate the folders with your arrow keys. If you prefer 'Vim' type settings, you can avoid using the arrow keys by remapping your keys to the typical Vim settings (hjkl).

    • h will minimize/open a folder
    • j will navigate down (i.e. down arrow)
    • k will navigate up (i.e. up arrow)
    • l will open up a folder
    • Enter will open the file

    Key mappings

    To set this up, open Preferences > Key Bindings - User and add the following:

    { "keys": ["h"], "command": "move", "args": {"by": "characters", "forward": false}, "context":
        [ {"key": "control", "operand": "sidebar_tree"} ] },
    { "keys": ["j"], "command": "move", "args": {"by": "lines", "forward": true}, "context":
        [ {"key": "control", "operand": "sidebar_tree"} ] },
    { "keys": ["k"], "command": "move", "args": {"by": "lines", "forward": false}, "context":
        [ {"key": "control", "operand": "sidebar_tree"} ] },
    { "keys": ["l"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
        [ {"key": "control", "operand": "sidebar_tree"} ] }
    
    0 讨论(0)
  • 2021-01-29 18:31

    Ctrl+p is also really useful for opening files without using the mouse.

    If you open a folder in Sublime all the files in that folder (and files in contained folders) will show up in the search you get with Ctrl+p.

    Just hit Ctrl+p and start typing parts of the filename and you'll get a list of matches.

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

    In Sublime Text2, press keys in following format "Ctrl+k+b" and it will work on ubuntu.

    It worked on my machine (v14.04 LTS)

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

    For sublime text 3 use Ctrl+K+B

    Press and hold Ctrl then press and holdK and then press B

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

    Another option is to use the FileBrowser package, which gives you many more actions and can be modified to your needs.

    https://packagecontrol.io/packages/FileBrowser

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