Sublime Forum

Open sublime user folder

#1

I would like to make a hotkey that will open my user folder.

I have added the following in my user keymapping, but it does not succeed in opening my user directory.

{ "keys": ["ctrl+alt+u"], "command": "open_dir", "args": {"dir": "res://Packages/User/"} }

What am I missing here?

0 Likes

#2

just a guess, but the res protocol is probably not supported - consider instead using the $packages variable:

{ "dir": "$packages/User/"}
2 Likes

#3

That fixed it.

But what differentiates that key mapping, from the following one, where the res protocol is working?

{ "keys": ["ctrl+;"], "command": "run_macro_file", "args": {"file": "res://Packages/User/end_line.sublime-macro"}},

1 Like

#4

I would guess that it’s because the open_dir command expects the name of a directory to open ($packages is expanded to a directory name) while the run_macro_file command expects to take a resource; possibly because it’s likely that a macro might be contained in a sublime-package file (zip archive).

3 Likes

#5

They are different commands, basically. open_file also supports the $variable expansion that open_dir does. I only know of two variables that are supported, however: $packages and $platform. (These can be found in default configuration files.)

0 Likes