Sublime Forum

Use file names as patterns

#1

Hi,

I’m creating a json-tmLanguage for my own scope file, and I’d like to know if it is possible to use filenames from a specific directory as patterns.

Exemple :
In my “Command” folder of my project, I may have :
echo.md
lost.md
read.md

And what I wanted is to highlight $echo $lost or $read in my custom scope.

thank you :smile:

0 Likes

#2

I didn’t want to start a new thread, but I have the same question. Rather than specifying file_extensions in the syntax file, I would like the to specify a full file-name.

In my case, I would like to write a syntax-file matching installer.cfg files, which basically imports all rules from .cfg / .ini, but has some special rules unique.

My Sublime Text setup differentiates JavaScript from JavaScript (Gulpfile), so it seems it’s possible. I have already searched the sources for the default JavaScript package and the Babel package (the only JavaScript packages I have installed). Unfortunately, I haven’t found anything pointing me to how this could be done.

0 Likes

#3

AFAIK specifying a full file name only works if the file is extension-less:

I also did a search at the Babel GitHub repo and didn’t find any hits for “Gulpfile”… Maybe some other package is doing this?

I think the only workaround for now is to have an on_load / on_save hook in a plugin, to apply the syntax if the file name is installer.cfg

2 Likes

#4

I have identified the package and will dig deeper into the source after work.

Thanks for your suggestion!

0 Likes