config

#brew#nushell

git clone https://git.pyrossh.dev/config

Common configuration


helix/grammars/hica.tmLanguage.json
{
  "name": "Hica",
  "scopeName": "source.hica",
  "fileTypes": ["hc"],
  "patterns": [
    { "include": "#comments" },
    { "include": "#strings" },
    { "include": "#chars" },
    { "include": "#numbers" },
    { "include": "#keywords" },
    { "include": "#functions" },
    { "include": "#types" },
    { "include": "#operators" },
    { "include": "#identifiers" }
  ],
  "repository": {
    "comments": {
      "name": "comment.line.double-slash.hica",
      "match": "//.*$"
    },
    "strings": {
      "name": "string.quoted.double.hica",
      "begin": "\"",
      "end": "\"",
      "patterns": [
        {
          "name": "constant.character.escape.hica",
          "match": "\\\\[ntr\\\\\"'{}$]"
        },
        {
          "name": "string.interpolation.hica",
          "begin": "\\$\\{",
          "beginCaptures": {
            "0": { "name": "punctuation.definition.interpolation.begin.hica" }
          },
          "end": "\\}",
          "endCaptures": {
            "0": { "name": "punctuation.definition.interpolation.end.hica" }
          },
          "patterns": [
            { "include": "#strings" },
            { "include": "#keywords" },
            { "include": "#types" },
            { "include": "#numbers" },
            { "include": "#operators" },
            { "include": "#identifiers" }
          ]
        }
      ]
    },
    "chars": {
      "name": "string.quoted.single.hica",
      "match": "'[^']'"
    },
    "numbers": {
      "patterns": [
        { "name": "constant.numeric.float.hica", "match": "\\b[0-9]+\\.[0-9]+\\b" },
        { "name": "constant.numeric.integer.hex.hica", "match": "\\b0x[0-9a-fA-F]+\\b" },
        { "name": "constant.numeric.integer.binary.hica", "match": "\\b0b[01]+\\b" },
        { "name": "constant.numeric.integer.hica", "match": "\\b[0-9]+\\b" }
      ]
    },
    "keywords": {
      "patterns": [
        { "name": "keyword.control.hica", "match": "\\b(if|else|match|while|loop|for|in|break|continue|return)\\b" },
        { "name": "keyword.declaration.hica", "match": "\\b(let|var|fun|struct|trait|class|primitive|lib|import|from|pub|extern|out)\\b" },
        { "name": "keyword.declaration.hica", "match": "\\bself\\b" },
        { "name": "constant.language.hica", "match": "\\b(true|false|None|Some|Ok|Err)\\b" }
      ]
    },
    "functions": {
      "patterns": [
        {
          "name": "entity.name.function.hica",
          "comment": "Function name in definition: fun name(",
          "match": "(?<=\\bfun\\s+)[a-z_][a-zA-Z0-9_]*(?=\\s*\\(|\\s*<)"
        },
        {
          "name": "entity.name.function.hica",
          "comment": "Function call: name(",
          "match": "\\b[a-z_][a-zA-Z0-9_]*(?=\\s*\\()"
        }
      ]
    },
    "types": {
      "name": "support.type.hica",
      "match": "\\b(Int|Float|Bool|Char|CStr|String|ptr|int|float|bool|char|string|cstr)\\b"
    },
    "operators": {
      "name": "keyword.operator.hica",
      "match": "(\\+|-|\\*|/|%|==|!=|<|>|<=|>=|&&|\\|\\||!|\\|>|=|=>|\\.\\.=?|\\?|::|\\.\\.\\.)"
    },
    "identifiers": {
      "patterns": [
        {
          "name": "entity.name.type.hica",
          "comment": "Uppercase-starting identifiers are types/constructors",
          "match": "\\b[A-Z][a-zA-Z0-9_]*\\b"
        },
        {
          "name": "variable.other.hica",
          "match": "\\b[a-z_][a-zA-Z0-9_]*\\b"
        }
      ]
    }
  }
}