Sublime Forum

Need help with JSON for .sublime-commands on Windows?


I’m on Windows and I’m not sure about the correct format I should use for "file":"" in the following .sublime-commands file:

      "caption":"Do the Foo",

For example, if this:

"file":"C:\\Users\\Ahu Lee\\YandexDisk\\utils\\Sublime Text Build 3207\\Data\\Packages\\User\\Select Line.sublime-macro"

…then it won’t work, but I can still see the caption. The same with forward slashes (with single backslashes I won’t even see the caption).

What’s the error here? Why won’t it work?

PS The macro file is in the right place and it works via the menu.




The path should be strictly relative, like this:

"file": "Packages/User/Select Line.sublime-macro"


Nitpicking a bit, the path should be a “resource path”, not a true file path. Resource paths always start with “Packages” or “Cache” and use slashes regardless of platform. A resource path does not correspond one-to-one to a file path, because packages in the Packages directory, installed packages, and the core packages bundled with Sublime all have resource paths beginning with “Packages/<name>”.