aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_sh.lua
blob: e76cabcc86d84045fdcb8015410547ea9e7f4c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
local syntax = require "core.syntax"

syntax.add {
  files = { "%.sh$" },
  comment = "#",
  patterns = {
    { pattern = "#.*\n",                  type = "comment"  },
    { pattern = [[\.]],                   type = "normal"   },
    { pattern = { '"', '"', '\\' },       type = "string"   },
    { pattern = { "'", "'", '\\' },       type = "string"   },
    { pattern = "%f[%w_][%d%.]+%f[^%w_]", type = "number"   },
    { pattern = "[!<>|%[%]=*]",           type = "operator" },
    { pattern = "%f[%S]%-[%w%-_]+",       type = "function" },
    { pattern = "$[%a_@*][%w_]*",         type = "keyword2" },
    { pattern = "[%a_][%w_]*",            type = "symbol"   },
  },
  symbols = {
    ["if"]    = "keyword",
    ["then"]  = "keyword",
    ["elif"]  = "keyword",
    ["else"]  = "keyword",
    ["fi"]    = "keyword",
    ["echo"]  = "keyword",
    ["true"]  = "literal",
    ["false"] = "literal",
  },
}