-1

Here's a custom key binding I have in ST3:

{ "keys": ["super+shift+e"], "command": "open_dir", "args": {"dir": "$file_path", "file": "$file_name"} }

I would like to edit/view the command functions referenced in this JSON key binding (e.g. open_dir, which opens Finder). I want to see the code behind open_dir to see how it works.

The JSON file of this key binding is Default (OSX).sublime-keymap. I've done file searches in ~/Library/Application Support/Sublime Text 3/ as well as in Applications/Sublime Text/ for command names such as open_dir but I still can't find the code of the commands that the JSON script is referencing.

Is there a way to find and view the commands that the JSON script is referencing?

EDIT: Thanks and apologies to those who commented before I made this edit. I've changed the title and the question text pretty heavily to try to be clearer since the post got put on hold.

colossatr0n
  • 1,297
  • 9
  • 15

2 Answers2

1

JSON is parsed, not interpreted. Plus they are not executable, much like a plain text file.

Therefore, you use python as normal to run a subprocess, but from a parsed value rather than a hard coded command

OneCricketeer
  • 126,858
  • 14
  • 92
  • 185
0

Its a bit unclear from your question what your end goal really is. You should provide some examples.

If you are looking to parse JSON data, extracted from a file, and execute in the terminal, then using the subprocess is likely the way to go.

Calling an external command in Python

cybergoof
  • 1,217
  • 2
  • 14
  • 25