From 4c03bbeaff3edfd79648cd75347f1bb90d493592 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Mon, 22 Jul 2024 21:36:20 +0200 Subject: [PATCH] fix: correctly match exact filenames in language plugins --- manifest.json | 18 +++++++++--------- plugins/language_caddyfile.lua | 4 ++-- plugins/language_cmake.lua | 2 +- plugins/language_fstab.lua | 4 ++-- plugins/language_make.lua | 4 ++-- plugins/language_meson.lua | 4 ++-- plugins/language_pkgbuild.lua | 10 +++++----- plugins/language_ruby.lua | 2 +- plugins/language_sh.lua | 10 +++++----- plugins/language_ssh_config.lua | 5 ++--- 10 files changed, 31 insertions(+), 32 deletions(-) diff --git a/manifest.json b/manifest.json index e6d7422a..2f62b521 100644 --- a/manifest.json +++ b/manifest.json @@ -768,7 +768,7 @@ "tags": [ "language" ], - "version": "0.1" + "version": "0.1.1" }, { "description": "Syntax for the [Carbon programming language](https://github.com/carbon-language/carbon-lang).", @@ -798,7 +798,7 @@ "tags": [ "language" ], - "version": "0.2" + "version": "0.2.1" }, { "description": "Syntax for [Containerfile](https://github.com/containers/common/blob/main/docs/Containerfile.5.md)/[Dockerfile](https://docs.docker.com/engine/reference/builder/)", @@ -978,7 +978,7 @@ "tags": [ "language" ], - "version": "0.1" + "version": "0.1.1" }, { "description": "Syntax for the [GABC](https://gregorio-project.github.io/gabc) music typesetting language", @@ -1249,7 +1249,7 @@ "tags": [ "language" ], - "version": "0.1" + "version": "0.1.1" }, { "description": "Syntax for [MARTe2](https://vcis.f4e.europa.eu/marte2-docs/master/html/index.html) configuration language", @@ -1269,7 +1269,7 @@ "tags": [ "language" ], - "version": "0.1" + "version": "0.1.1" }, { "description": "Syntax for the [MiniScript](https://miniscript.org) programming language", @@ -1399,7 +1399,7 @@ "tags": [ "language" ], - "version": "0.1" + "version": "0.1.1" }, { "description": "Syntax for [PO](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) translation files", @@ -1480,7 +1480,7 @@ "tags": [ "language" ], - "version": "0.1" + "version": "0.1.1" }, { "description": "Syntax for the [Rust](https://rust-lang.org/) programming language", @@ -1530,7 +1530,7 @@ "tags": [ "language" ], - "version": "0.2" + "version": "0.2.1" }, { "description": "Syntax for ssh & sshd config files", @@ -1540,7 +1540,7 @@ "tags": [ "language" ], - "version": "0.1" + "version": "0.1.1" }, { "description": "Syntax for the [Uxntal](https://wiki.xxiivv.com/site/uxntal) assembly language", diff --git a/plugins/language_caddyfile.lua b/plugins/language_caddyfile.lua index f918c166..d600aa07 100644 --- a/plugins/language_caddyfile.lua +++ b/plugins/language_caddyfile.lua @@ -2,10 +2,10 @@ local syntax = require "core.syntax" syntax.add { - files = { "Caddyfile" }, + files = { PATHSEP .. "Caddyfile$" }, comment = "#", patterns = { - { pattern = { "#", "\n"}, type = "comment" }, + { pattern = "#.*", type = "comment" }, { pattern = { '"', '"', '\\' }, type = "string" }, -- Matcher definition { pattern = "@[%w_]+", type = "operator" }, diff --git a/plugins/language_cmake.lua b/plugins/language_cmake.lua index aa6077c3..7281c642 100644 --- a/plugins/language_cmake.lua +++ b/plugins/language_cmake.lua @@ -3,7 +3,7 @@ local syntax = require "core.syntax" syntax.add { name = "CMake", - files = { "%.cmake$", "CMakeLists.txt$" }, + files = { "%.cmake$", PATHSEP .. "CMakeLists.txt$" }, comment = "#", block_comment = { "#[[", "]]" }, patterns = { diff --git a/plugins/language_fstab.lua b/plugins/language_fstab.lua index bbe418e8..5032cae7 100644 --- a/plugins/language_fstab.lua +++ b/plugins/language_fstab.lua @@ -4,12 +4,12 @@ local syntax = require "core.syntax" syntax.add { name = "fstab", - files = { "fstab" }, + files = { PATHSEP .. "fstab$" }, comment = '#', patterns = { -- Only lines that start with a # are comments; you can have #'s in fuse -- filesystem strings that aren't comments, so shouldn't be highlighted as such. - { regex = "^#.*$", type = "comment" }, + { regex = "^#.*", type = "comment" }, { pattern = "[=/:.,]+", type = "operator" }, { pattern = "/.*/", type = "string" }, { pattern = "#", type = "operator" }, diff --git a/plugins/language_make.lua b/plugins/language_make.lua index 4ad3521a..cb1597ae 100644 --- a/plugins/language_make.lua +++ b/plugins/language_make.lua @@ -3,10 +3,10 @@ local syntax = require "core.syntax" syntax.add { name = "Makefile", - files = { "Makefile", "makefile", "%.mk$" }, + files = { PATHSEP .. "Makefile$", PATHSEP .. "makefile$", "%.mk$" }, comment = "#", patterns = { - { pattern = "#.*\n", type = "comment" }, + { pattern = "#.*", type = "comment" }, { pattern = [[\.]], type = "normal" }, { pattern = "$[@^<%%?+|*]", type = "keyword2" }, { pattern = "$%(.-%)", type = "symbol" }, diff --git a/plugins/language_meson.lua b/plugins/language_meson.lua index be10d66d..ebf906f7 100644 --- a/plugins/language_meson.lua +++ b/plugins/language_meson.lua @@ -3,10 +3,10 @@ local syntax = require "core.syntax" syntax.add { name = "Meson", - files = { "^meson%.build$", "^meson_options%.txt$" }, + files = { PATHSEP .. "meson%.build$", PATHSEP .. "meson_options%.txt$" }, comment = "#", patterns = { - { pattern = { "#", "\n" }, type = "comment" }, + { pattern = "#.*", type = "comment" }, { pattern = { "'", "'", '\\' }, type = "string" }, { pattern = { "'''", "'''" }, type = "string" }, { pattern = "0x[%da-fA-F]+", type = "number" }, diff --git a/plugins/language_pkgbuild.lua b/plugins/language_pkgbuild.lua index 049a5d1a..5c6a3c5e 100644 --- a/plugins/language_pkgbuild.lua +++ b/plugins/language_pkgbuild.lua @@ -3,12 +3,12 @@ local syntax = require "core.syntax" syntax.add { name = "PKGBUILD", - files = "/*PKGBUILD$", + files = { PATHSEP .. "PKGBUILD$" }, comment = "#", patterns = { -- Don't colorize number of arguments expression as comment - { pattern = "$#", type = "keyword2" }, - { pattern = "#.*\n", type = "comment" }, + { pattern = "%$#", type = "keyword2" }, + { pattern = "#.*", type = "comment" }, -- Strings { pattern = { '"', '"', '\\' }, type = "string" }, { pattern = { "'", "'", '\\' }, type = "string" }, @@ -48,8 +48,8 @@ syntax.add { -- Match variable assignments { pattern = "[_%a][%w_]+%f[%+=]", type = "keyword2" }, -- Match variable expansions - { pattern = "${.-}", type = "keyword2" }, - { pattern = "$[%d$%a_@*][%w_]*", type = "keyword2" }, + { pattern = "%${.-}", type = "keyword2" }, + { pattern = "%$[%d%$%a_@*][%w_]*", type = "keyword2" }, -- Functions { pattern = "[%a_%-][%w_%-]*[%s]*%f[(]", type = "function" }, -- Everything else diff --git a/plugins/language_ruby.lua b/plugins/language_ruby.lua index c46d5585..75da3e0d 100644 --- a/plugins/language_ruby.lua +++ b/plugins/language_ruby.lua @@ -3,7 +3,7 @@ local syntax = require "core.syntax" syntax.add { name = "Ruby", - files = { "%.rb$", "%.gemspec$", "^Gemfile$", "^Gemfile%.lock$" }, + files = { "%.rb$", "%.gemspec$", PATHSEP .. "Gemfile$", PATHSEP .. "Gemfile%.lock$" }, headers = "^#!.*[ /]ruby", comment = "#", patterns = { diff --git a/plugins/language_sh.lua b/plugins/language_sh.lua index f8cf5521..d281f7e0 100644 --- a/plugins/language_sh.lua +++ b/plugins/language_sh.lua @@ -3,15 +3,15 @@ local syntax = require "core.syntax" syntax.add { name = "Shell script", - files = { "%.sh$", "%.bash$", "^%.bashrc$", "^%.bash_profile$", "^%.profile$", "%.zsh$", "%.fish$" }, + files = { "%.sh$", "%.bash$", PATHSEP .. "%.bashrc$", PATHSEP .. "%.bash_profile$", PATHSEP .. "%.profile$", "%.zsh$", "%.fish$" }, 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 = "%$[%a_@*#][%w_]*", type = "keyword2" }, -- Comments - { pattern = "#.*\n", type = "comment" }, + { pattern = "#.*", type = "comment" }, -- Strings { pattern = { '"', '"', '\\' }, type = "string" }, { pattern = { "'", "'", '\\' }, type = "string" }, @@ -35,8 +35,8 @@ syntax.add { -- Match variable assignments { pattern = "[_%a][%w_]+%f[%+=]", type = "keyword2" }, -- Match variable expansions - { pattern = "${.-}", type = "keyword2" }, - { pattern = "$[%d$%a_@*][%w_]*", type = "keyword2" }, + { pattern = "%${.-}", type = "keyword2" }, + { pattern = "%$[%d%$%a_@*][%w_]*", type = "keyword2" }, -- Functions { pattern = "[%a_%-][%w_%-]*[%s]*%f[(]", type = "function" }, -- Everything else diff --git a/plugins/language_ssh_config.lua b/plugins/language_ssh_config.lua index 894ce218..d507ef48 100644 --- a/plugins/language_ssh_config.lua +++ b/plugins/language_ssh_config.lua @@ -3,10 +3,10 @@ local syntax = require "core.syntax" syntax.add { name = "SSH config", - files = { "sshd?/?_?config$" }, + files = { PATHSEP .. "sshd?" .. PATHSEP .. "?_?config$" }, comment = '#', patterns = { - { pattern = "#.*\n", type = "comment" }, + { pattern = "#.*", type = "comment" }, { pattern = "%d+", type = "number" }, { pattern = "[%a_][%w_]*", type = "symbol" }, { pattern = "@", type = "operator" }, @@ -45,7 +45,6 @@ syntax.add { ["RekeyLimit"] = "keyword", ["SendEnv"] = "keyword", ["HashKnownHosts"] = "keyword", - ["GSSAPIAuthentication"] = "keyword", -- sshd config ["Subsystem"] = "keyword2",