Sublime Forum

Hotkey to find a file in a specific folder, always

#1

I like how the super+t hotkey works, to open the file finder, for files in the current folder.

I’d like a similar hotkey, but one that finds in ~/notes, always, no matter the current folder. I’ve been searching on how to configure this for a few weeks now, but couldn’t find anything. I’m okay even if it requires a new Python plugin file if that’s what it takes, but I couldn’t find much guidance on this either.

Any pointers please?

0 Likes

#2

Is this a built-in functionality for ST on MacOS?

0 Likes

#3

It’s the standard hotkey, I think default only for macOS, perhaps, but is defined as the following:

{ "keys": ["super+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
0 Likes

#4
{
    "keys": [
        "super+t"
    ],
    "command": "show_overlay",
    "args": {
        "overlay": "goto",
        "show_files": true,
        "text": "~/notes/" // <------------------
    }
},
1 Like

#5

Ah thanks! I didn’t know about the text key. However, it appears to list only files that are already open in tabs, instead of letting me choose from all files recursively under that folder.

0 Likes

#6

It’s exactly the same with super+t but pre-fill the text for you.

0 Likes

#7

Right, that’s how the "text" key works, but unfortunately, doesn’t do what I wanted.

See, when I hit super+t, I see all files recursively in the current folder, and I an choose from them to open a file.

But, when I define a key binding like below:

	{ "keys": ["super+e"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true, "text": "~/notes"} },

I get choices of files under ~/notes that are already open in my editor only, not all the files under ~/notes.

Is it possible to do that?

0 Likes

#8

I guess you didn’t open the ~/notes as a project but just opened several single files. Then, no. Instead of writing a plugin, I would say just open it as a project. Just open the ~/notes in ST and that’s all. "text": "~/notes" may need some tweak.

If you still want to go the plugin way, os.walk can visit a directory recursively. ST’s window.show_quick_panel API allows you to create a panel like super+t.

0 Likes

#9

Yes. I wanted to access files from my notes folder irrespective of what project I’m in.

Well, looks like I have to do this via a new plugin, collecting the files recursively myself. Cool, thanks much for your inputs @jfcherng!

1 Like