From b53c5eb773b9fd3bd0ea277fe60e2129778cfdb5 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Fri, 8 Oct 2021 13:33:23 +0200 Subject: Fix language_sh to recognize 0 bash variable --- plugins/language_sh.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/language_sh.lua b/plugins/language_sh.lua index f21557d..9159f3b 100644 --- a/plugins/language_sh.lua +++ b/plugins/language_sh.lua @@ -6,6 +6,9 @@ syntax.add { headers = "^#!.*bin.*sh\n", comment = "#", patterns = { + -- $# is a bash special variable and the '#' shouldn't be interpreted + -- as a comment. + { pattern = "$[%a_@*#][%w_]*", type = "keyword2" }, { pattern = "#.*\n", type = "comment" }, { pattern = [[\.]], type = "normal" }, { pattern = { '"', '"', '\\' }, type = "string" }, @@ -15,7 +18,6 @@ syntax.add { { pattern = "[!<>|&%[%]=*]", type = "operator" }, { pattern = "%f[%S]%-[%w%-_]+", type = "function" }, { pattern = "${.-}", type = "keyword2" }, - { pattern = "$[%a_@*][%w_]*", type = "keyword2" }, { pattern = "[%a_][%w_]*", type = "symbol" }, }, symbols = { -- cgit v1.2.3