Not that I’m aware of, no. You would indeed have to manually load the files and merge their contents yourself. However, sublime.decode_value()
can turn a loaded keymap file into a JSON object and sublime.find_resources()
can find all of the files (and returns them in the order they would be merged).
sublime.find_resources("*.sublime-keymap")
would find every keymap, while sublime.find_resources("*(OSX).sublime-keymap")
would only find the OSX specific ones, for example.
You can’t provide the variable ${platform}
because find_resources()
doesn’t expand variables. You could however do the following to find only the files for the current platform (i.e. expand the variable yourself).
spec = "*(${platform}).sublime-keymap"
res_name = sublime.expand_variables(spec, window.extract_variables())
sublime.find_resources(res_name)
However for a proper result you probably need to find all of the resource files and then exclude any of the platform specific ones that aren’t for the current platform as you go through the list, or you may end up merging things in the wrong order.