pythonsublimetext3sublimetextsublime-text-plugininline-code

Inline Python Code in Sublime Snippets


Is it possible to write Python(Sublime Text API) in a .sublime-snippet file.

Like if I want to grab a value from .sublime-settings file and insert it into a snippet.

Example:
File random.sublime-settings consists of

[
{
  "key1": "value1";
  "key2": "value2"
}
]

So if I want to insert "value1" and "value2" in a snippet, how do I do it?, First off is there a way this is even possible?.


Solution

  • Unfortunately, you cannot execute code with .sublime-snippet files. In order to do what you want to do, you'll need to write a plugin. To execute it, you can either bind a key combination to it, or create a macro.