Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly match exact filenames in language plugins #466

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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).",
Expand Down Expand Up @@ -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/)",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -1269,7 +1269,7 @@
"tags": [
"language"
],
"version": "0.1"
"version": "0.1.1"
},
{
"description": "Syntax for the [MiniScript](https://miniscript.org) programming language",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1480,7 +1480,7 @@
"tags": [
"language"
],
"version": "0.1"
"version": "0.1.1"
},
{
"description": "Syntax for the [Rust](https://rust-lang.org/) programming language",
Expand Down Expand Up @@ -1530,7 +1530,7 @@
"tags": [
"language"
],
"version": "0.2"
"version": "0.2.1"
},
{
"description": "Syntax for ssh & sshd config files",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions plugins/language_caddyfile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
2 changes: 1 addition & 1 deletion plugins/language_cmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions plugins/language_fstab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
4 changes: 2 additions & 2 deletions plugins/language_make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
4 changes: 2 additions & 2 deletions plugins/language_meson.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
10 changes: 5 additions & 5 deletions plugins/language_pkgbuild.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugins/language_ruby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
10 changes: 5 additions & 5 deletions plugins/language_sh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions plugins/language_ssh_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -45,7 +45,6 @@ syntax.add {
["RekeyLimit"] = "keyword",
["SendEnv"] = "keyword",
["HashKnownHosts"] = "keyword",
["GSSAPIAuthentication"] = "keyword",

-- sshd config
["Subsystem"] = "keyword2",
Expand Down