Hello all,
I would like to add: if __name__ == '__main__':
as a symbol in the Python syntax so I can quickly snap to the location, as is possible with functions and classes.
I followed the directions from: How to add a global custom symbol marker?
in summary:
- edit Symbol List.tmPreferences: (edit in ** ** brackets)
<?xml version="1.0" encoding="UTF-8"?> <plist version="1.0"> <dict> <key>scope</key> <string> source.python entity.name.class, source.python entity.name.function, **source.python entity.name.if-name** </string> <key>settings</key> <dict> <key>showInIndexedSymbolList</key> <integer>1</integer> <key>showInSymbolList</key> <integer>1</integer> </dict> </dict> </plist>
- edit Python.sublime-syntax, adding a new entry under contexts, at the end of the document:
if-name:
- match:"if __name__ == '__main__':"
push:
- match: “(?={{identifier}})”
push:
- meta_content_scope: entity.name.if-name.python
- match: ‘’
pop: true
Not sure this is right, just copying and replacing what is there for functions and classes. File saved without errors and does not show up in the GoTo symbol list?