3.8 KiB
Contributing to onedark.vim
Please read this document before submitting a Pull Request.
Pull Requests containing changes to files in the autoload/
or colors/
directories without corresponding changes to files in the build/templates
directory will not be merged.
Build System
Background Information
onedark.vim's shared color definitions file autoload/onedark.vim
and its companion Xresources color palette file are built using a rudimentary templating and build system that allows color definitions to live in a single, central file. (Additional terminal color palette files are themselves generated from the template-produced Xresources file.)
The basic idea is that these files are generated by a build tool that substitutes color values into templates that live in build/templates
.
Here are the locations of the files that are generated by the build system, along with the locations of the corresponding templates they are generated from:
Theme Location | Template Location |
---|---|
autoload/onedark.vim |
build/templates/autoload.template.vim |
term/One Dark.Xresources |
build/templates/One Dark.Xresources |
term/One Dark.itermcolors |
build/templates/One Dark.itermcolors |
term/One Dark.terminal |
build/templates/One Dark.terminal |
term/One Dark.alacritty |
build/templates/One Dark.alacritty |
Configure It
-
Install Node.js (Installing via nvm or homebrew are both better options than the official Node.js installer.)
-
Run the following from within the root of this repository. This will install the build system's dependencies and will automatically configure a Git pre-commit hook that runs
npm test
(see below).
> cd build
> npm install
That's it!
Use It
The build system consists of a single Node.js script, build.js
, which supports two commands:
- Running
./build.js
ornpm run build
generates theme files from the templates, overwriting changes to the theme files without confirmation. - Running
./build.js check
ornpm test
checks that the theme files match the template-generated output, without modifying theme files. This command ensures that the theme files perfectly match the templates they are generated from, which is useful for detecting changes that were made to generated theme files but that should have been made in the templates. (In addition to running./build.js check
,npm test
also runs eslint linting on the build system code to catch and prevent simple problems with changes to that code.)
The basic development workflow looks like this:
-
Make changes to the appropriate template files in
build/templates
, then runnpm run build
from inside thebuild
directory. -
Commit your change in Git.
npm test
will automatically run before your commit is finalized. If the test fails, fix any inconsistencies between the template files and theme files (or linting errors inbuild.js
if applicable), then try committing again.
Style Guidelines
Please match the existing comment and whitespace style in all template files.
For the "Language-Specific Highlighting" portion of onedark.vim, blocks for each language should be organized alphabetically ("Markdown" comes before "PHP").
Any changes to the JavaScript code in the build system should pass against the included eslint rules; you can manually check for linting errors by running npm test
from inside the build
directory.
Thanks!
Thanks very much for contributing to onedark.vim!