Sublime Forum

highlighting non-english letters

#1

How can I make non-english letters highlighting in any syntax highlighting?

0 Likes

#2

Matching words excluding ascii should work.

    - match: '[[:word:]&&[^[:ascii:]]]'
      scope: constant.character.non-english
0 Likes

#3

Did I understand correctly?

example.sublime-syntax

%YAML 1.2
---
name: Example
file_extensions:
  - txt
scope: text.txt
contexts:
  nonenglish:
    - match: '[[:word:]&&[^[:ascii:]]]'
      scope: constant.character.non-english

Now in which file should I change the colors?
Or where can I read about what should I do next?

0 Likes

#4

A syntax definition requires a main context. So replacing nonenglish: by main: makes your syntax valid.

%YAML 1.2
---
name: Example
file_extensions:
  - txt
scope: text.txt
contexts:
  main:
    - match: '[[:word:]&&[^[:ascii:]]]'
      scope: constant.character.non-english

Colors are defined by your color scheme then. constant.character is part of most schemes and therefore should result in nonenglish chars to have different color already.

Otherwise you can call “UI: Customize Color Scheme” from command palette and add a custom “rule”.

0 Likes