I have a plain text file that looks like this
=Chapter 1
some text
=Chapter 2
some text
How to tell sublime that the pattern ‘=\w.*’ is a symbol?
So that when I do ‘Go to Symbol’ I can see the list of chapters.
I tried the following standard approach, a sublime-syntax file + a tmPreferences files. It doesn’t work, maybe there is something wrong in those two files.
Plain Text.sublime-syntax
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Plain Text
file_extensions:
- txt
scope: text.plain
contexts:
main:
- match: '=+\s*(\w.*)'
scope: meta.function.text.plain
captures:
1: entity.name.function.text.plain
Plain Text.tmPreferences
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Symbol List</string>
<key>scope</key>
<string>text.plain meta.function.text.plain</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
<integer>1</integer>
</dict>
</dict>
</plist>