Sublime Forum

Sidebar Icons - Way of targeting a specific filename?

#1

[code]<?xml version="1.0" encoding="UTF-8"?>

scope ??? settings icon file_type_gitignore [/code]

Hello,

Not sure if this is the right place to ask. I’ve been hunting around the internet, trying to find the answer to this, but I don’t think I’m asking the right question of google.

Anyway. I’m trying to target a specific filename, of a file in the sidebar, to add a special icon to it. I want to be able to add special icons to things like .gitignore and bower.json, packages.json, while keeping regular .json files kinda dull. Is there any way of targeting a specific filename?

Any hints would be appreciated.

0 Likes

#2

Furthermore, being able to do something like the following would be great.

<key>filename</key>
<string>*.psd</string>
0 Likes

#3

here is for the json

[code]<?xml version="1.0" encoding="UTF-8"?>

scope source.json settings icon file_type_node [/code] so make a folder call "Theme - Default" in ur packages folder and save the file as json.tmPreferences (you can name it anything u want as ST only check whats inside the file not the file name it self) ,about the dotfiles so it targets all the hidden files am still hunting that too.
0 Likes

#4

How about targeting by filename rather than extension?
For example, setting a certain icon for JS files and then a separate one for gulpfile.js?

0 Likes

#5

Not possible.

0 Likes

#6

I don’t know if it still relevant, but I found the way. You need to create a syntax file and add the target name to a file_extensions. For example

%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Log
file_extensions:
  - log
  - log.txt
scope: text.log
hidden: true
contexts:
  main:
    - include: scope:text

And then just watch for this syntax in your tmPreferences like this

<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
  <dict>
    <key>scope</key>
    <string>text.log</string>
    <key>settings</key>
    <dict>
      <key>icon</key>
      <string>log</string>
    </dict>
  </dict>
</plist>
0 Likes

#7

That’s actually what A File Icon is doing to add all the different file type specific icons.

0 Likes