Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.vim]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto eol=lf

# Generated from keywords.json — collapse it in review diffs.
syntax/gnuplot.vim linguist-generated=false
keywords.json linguist-generated=true
132 changes: 132 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
dpezto@icloud.com.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
78 changes: 78 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Contributing

Thanks for helping out. Small, focused PRs merge fastest.

## Where a change belongs

`syntax/gnuplot.vim` has two halves. Everything between the generated markers
comes from `keywords.json` and must not be hand edited — CI fails if the
committed block does not match what the generator produces. Everything outside
the markers (comments, strings, numbers, operators, control-flow words, the
highlight links) is hand maintained and edited directly.

To add or correct a keyword, fix it upstream in
[tree-sitter-gnuplot](https://github.com/dpezto/tree-sitter-gnuplot). Keeping
the two in step is the point of the arrangement; patching the generated block
locally defeats it.

You do not normally have to copy the dictionary by hand: `sync-keywords.yml`
compares the vendored `keywords.json` against the grammar's default branch every
Monday and opens a PR when they differ, regenerating the syntax file in the same
commit. Run it on demand from the Actions tab. Review those PRs rather than
rubber-stamping them — a keyword whose tier changed moves between highlight
groups, and one whose `min` changed alters which abbreviations are recognised.

## Development

```sh
npm run gen:syntax # regenerate from keywords.json
npm run check:syntax # what CI runs
nvim --headless -u NONE -S tests/run.vim # assertions
vim -es -u NONE -S tests/run.vim # same, under Vim
```

`tests/run.vim` uses Vim's own `assert_*` functions and exits non-zero if
anything lands in `v:errors`. Add a case for any behaviour a change could
break. The assertions read the raw syntax group under a given word rather than
the translated highlight group, because Vim collapses `Conditional`, `Repeat`
and `Keyword` into `Statement`, which would make most of them vacuous.

Verify claims about what gnuplot accepts against a real gnuplot, and check by
resolution rather than acceptance: gnuplot takes an ambiguous abbreviation and
silently resolves it to whichever entry comes first in its own table, so
`set encoding iso` succeeding does not mean `iso` names the encoding you meant.

## Commits and PR titles

PRs are squash-merged and releases are cut by
[release-please](https://github.com/googleapis/release-please) from the commit
history, so **PR titles must follow
[Conventional Commits](https://www.conventionalcommits.org)** (`feat: …`,
`fix: …`, `docs: …`). CI checks the title; `feat` and `fix` decide the version
bump and the CHANGELOG entry, and a `!` suffix or a `BREAKING CHANGE:` footer
forces a major.

Do **not** hand-edit versions. release-please owns `version.txt`,
`CHANGELOG.md` and the `version` and `date-released` fields of `CITATION.cff` —
the latter two through the `# x-release-please-version` and
`# x-release-please-date` markers on those lines. A file that is not listed
under `extra-files` in `.release-please-config.json` is silently never updated,
which is how a CITATION.cff goes stale without anyone noticing.

## AI-assisted contributions

AI assistance (Copilot, Claude, etc.) is welcome, with three rules:

1. **Disclose it** in the PR description (a one-liner is fine).
2. **You must understand and have tested the change yourself** — run the
assertions locally. You are the author; "the model wrote it" is not a review
response.
3. **No unreviewed dumps.** Large AI-generated diffs with no accompanying
reasoning, and AI-generated bug reports without a reproducible snippet, will
be closed.

## Bug reports

A minimal gnuplot snippet (confirmed accepted by `gnuplot` itself) plus what
you expected the highlighting to be turns a week of back-and-forth into a
same-day fix.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [dpezto]
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Bug report
description: A gnuplot construct highlights wrong, or not at all
labels: [bug]
body:
- type: input
id: version
attributes:
label: gnuplot.vim version / commit
placeholder: "a commit SHA"
validations:
required: true
- type: input
id: editor
attributes:
label: Editor
placeholder: "Neovim 0.12 / Vim 9.1"
validations:
required: true
- type: textarea
id: snippet
attributes:
label: Minimal gnuplot snippet
description: Smallest input that highlights wrong. Confirm it is accepted by `gnuplot` itself.
render: gnuplot
validations:
required: true
- type: textarea
id: behavior
attributes:
label: Expected vs actual
description: >-
Which word, and what it should be versus what it is. `:echo
synIDattr(synID(line("."), col("."), 1), "name")` with the cursor on the
word gives the group it currently gets.
validations:
required: true
- type: checkboxes
id: known
attributes:
label: Known limits
description: See the "Known limits" section of the README.
options:
- label: This is not a single-letter abbreviation that means two things (`p`, `f`)
- label: This is not an option head whose minimum is stricter upstream (`set xr`)
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Feature request
description: A gnuplot command/option not yet supported, or a query improvement
labels: [enhancement]
body:
- type: textarea
id: problem
attributes:
label: What's missing
description: The gnuplot syntax or highlight/fold/injection behavior the grammar doesn't handle yet.
validations:
required: true
- type: textarea
id: example
attributes:
label: Example
description: A gnuplot snippet showing the construct, and (if known) the relevant section of the gnuplot 6 docs.
render: gnuplot
validations:
required: false
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- PR title must be a Conventional Commit: feat|fix|docs|refactor|test|chore(scope): description -->

## What & why

## Checklist

- [ ] `npm run check:syntax` passes — the generated block matches `keywords.json`
- [ ] `nvim --headless -u NONE -S tests/run.vim` passes
- [ ] Added or extended a case in `tests/run.vim` for the new behaviour
- [ ] Any claim about what gnuplot accepts was checked against a real gnuplot,
by resolution rather than acceptance
- [ ] AI assistance disclosed (if any) — see [CONTRIBUTING](CONTRIBUTING.md)
16 changes: 16 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Security Policy

## Reporting a Vulnerability

Please report security vulnerabilities privately via
[GitHub's private vulnerability reporting](https://github.com/dpezto/gnuplot.vim/security/advisories/new)
rather than filing a public issue.

This is a parser grammar (no server component, no runtime secrets). The main
risk surface is:

- The external scanner (`src/scanner.c`): a crafted input causing out-of-bounds
reads / unbounded memory during parsing in an embedding editor.
- Supply-chain issues in CI (GitHub Actions dependencies).

Expect an initial response within a few days; this is a solo-maintained project.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
cooldown:
default-days: 5
Loading
Loading