sublim Text 中的位置高亮配色方案

问题描述 投票:0回答:0

我正面临一个漂亮的简单难问题。

上下文:
我经常使用带有位置记录的平面文件。它们很难被人类阅读,我们正在使用 3 种不同格式的位置记录。当我也使用 CSV 文件时,我正在使用 Rainbow CSV 使它们更具可读性,我喜欢它。所以.. 为什么不对位置文件做同样的事情?但我以前从未创建过包,我在这里挣扎。我选择通过正则表达式定义我的高亮部分,我不知道这是不是最好的主意,但这是我唯一的主意。

我的需求: 创建 sublim 文本包,允许我右键单击文件并选择我的高亮格式

我尝试了什么:

  • 在我的 Sublime Text /packages 中创建一个包
  • 添加文件.sublime-syntax

name: Schlumberger6 
file_extensions: [TXT]
scope: source.TXT
contexts:
  main:
    # Ligne de type 0 :
    - match: ^0.{127}
      scope: ligne0
    # Ligne de type 1:
    - match : ^1.{02}(\d{18}).*
      scope: refUexLigne1
    - match : ^1.{19}(\d{6}).*
      scope: dateReleveI

    # Règles de coloration
    - name: ligne0
      scope: ligne0
      settings:
        foreground: #808080
    - name : refUexLigne1
      scope: refUexLigne1
      settings :
        foreground : #FF0000
    - name : dateReleveI
      scope : dateReleveI
      settings : 
        foreground : #00FF00
  • Creating a file.py with a class and function supported to highlight my data : [removed]

很明显,此时我不再知道自己在做什么,需要一点帮助来解决这个问题。

  • 我觉得 sublim-syntax 应该足够了,但它根本不起作用
  • 我的 py 类应该让我在如何突出显示方面有更多的自由,但我缺少“菜单”部分以及如何按需调用它..

提前致谢!

编辑以添加更多信息:

这里是我处理的一个匿名文件,你可以看到它是位置文件,所以这就是为什么我决定使用正则表达式来分隔颜色语法区域。

0  95Absences repetees                                                                                                          
0  96                                                                                                                           
0  97                                                                                                                           
0  98                                                                                                                           
0  99Index de creation                                                                                                          
1010288220101       081221231120261119291118221117                                                                             *
201012387010100020100006 09090900000 A00006 00006 00006 00005 234567890 XXX     000000  0006 0009                              *
201028999010101010101241 09090900116 B01125 01006 00897 00780 234567890 XXX     000000  0006 0020                              *
201023452010101020100099 09090900013 C00086 00075 00068 00062 234567890 YY      000000  0006 0019                              *
201034567010102010100095 09090900010 D00085 00076 00066 00056 234567890 XXX     000000  0006 0027                              *
  • 添加 .sublime-color-scheme 文件,如 documentation 中所述:
{
    "name": "Schlumberger6"
    "globals":
    {
        "background": "#272822",
        "selection": "#49483E"
    },
    "rules":
    [
        {
            "name": "ligne0",
            "scope": "ligne0",
            "foreground": "#E6194B"
        },
        {
            "name": "refUexLigne1",
            "scope": "refUexLigne1",
            "foreground": "#3CB44B"
        },
        {
            "name": "dateReleveI",
            "scope": "dateReleveI",
            "foreground": "#FFE119"
        },
        {
            "name": "dateReleveI-1",
            "scope": "dateReleveI-1",
            "foreground": "#0082C8"
        }
        
    ]
}
sublimetext3 highlight sublime-text-plugin sublimetext4
© www.soinside.com 2019 - 2024. All rights reserved.