sublime text : open containing folder
Asked Answered
O

6

54

I'm working on some file in my sublime text 2 editor, and I want to open a folder in which that file resides.

I know there is a 2 step procedure to do this already

step 1: right click and reveal in sidebar (ctrl+shift+r)
step 2: right click on the same file in sidebar and click open containing folder.

I would like to know if there is only one shortcut key to do the same. This is something that I use quite often.

Olfe answered 16/10, 2013 at 18:25 Comment(1)
Although you cannot right click on the tab for a file to get the "Open containing..." option, you can right click on the editor area of a file to directly open it.Beating
I
97

You can add the line below to your Default (Windows).sublime-keymap:

{ "keys": ["ctrl+alt+e"], "command": "open_dir", 
    "args": {"dir": "$file_path", "file": "$file_name"} }
Idiocrasy answered 24/10, 2013 at 9:0 Comment(5)
You can copy and paste above inside [] after you click on Preferences > "Key Bindings - User" menu.Crescin
Strange. Maybe this key combination is overwritten globally by another app. On my mac I'm using: super+shift+eIdiocrasy
AFAIK, there isn't one. You'd need a plugin for that.Idiocrasy
I did as said, It's not working! I am using sublime text 3 on windows. Rechecking...Ok, got it, It worked. I missed a comma. LOL. Programmers biggest nightmare. Felt escaped! :DPalmieri
Remapping to a different key combination worked for me, as tborychowski suggested.Justajustemilieu
M
13

By default the editor has this item in context menu. If you need this feature on tabs you have to create a file with name "Tab Context.sublime-menu" in "\Data\Packages\User\" (if does not exist yet) and add this code:

[
    {
        "caption": "-"
    },
    {
        "command": "open_dir",
        "args": {"dir": "$file_path", "file": "$file_name"},
        "caption": "Open Containing Folder…"
    }
]

Do not forget formatting lines as a JSON file! If you do not need a separator before this menu item you need to delete first block with caption "-"! You can add any other menu in this file. For example:

{
    "command": "copy_path",
    "caption": "Copy File Path"
},
Musgrove answered 8/12, 2017 at 12:14 Comment(2)
By default the editor has this item in context menu. The latest Sublime versions seem to have lost this ability somehow, I can no longer right click on the file name at the top.Contumacious
This worked for me! I was able to open the directory By Topbar Menu -> Preferences -> Browse Packages (add User\MyNewPlugin folder here, and add the Tab Context.sublime-menu file inside that folder, w/ the specified contents)Woodnote
M
3

Install Open project path by shortcut. Then setup keybindings in your User keymap file

{
  "keys": ["f10"],
  "command": "open_project_folder"
},

{
  "keys": ["ctrl+f10"],
  "command": "open_file_folder"
}

Initiate the key bindings on a open file (f10 to open the directory you have set as the project folder, ctrl+f10 to open the folder of the current file.)

Menzies answered 16/10, 2013 at 20:1 Comment(1)
isn't there any inbuilt key for this? Do I have to install a new package?Olfe
I
3

This worked for me: assuming you have opened the file whose enclosing folder you want to open, use the Menu > Project > Add Folder To Project command.

A new window should open with the enclosing folder. Just click 'Open' and you're done!

Incommunicable answered 17/9, 2016 at 14:13 Comment(0)
C
2

I found this plugin: https://github.com/kallepersson/Sublime-Finder

The instructions are pretty straightforward-- I just use CMD+SHIFT+P and type "finder" and press enter and it opens a finder window.

I think this might only work on macs though.

Cecilececiley answered 21/6, 2017 at 0:44 Comment(0)
S
1

In sublimetext3 there is a package to sync current open file with the sidebar explorer. SyncedSidebar

Stigma answered 17/5, 2020 at 11:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.