This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
vim-dogrun is a dark Neovim/Vim colorscheme with extensive plugin support (50+ plugins). The project uses a Rust-based generator to create optimized, precompiled colorscheme files rather than maintaining Vim script manually.
Key Architecture:
- Source code: Rust generator in
generator/directory - Generated files:
colors/dogrun.vim,autoload/lightline/colorscheme/dogrun.vim,autoload/clap/themes/dogrun.vim - NEVER edit generated files directly - always modify the Rust source and regenerate
All commands should be run from the generator/ directory:
# Install development tools (just, bacon)
cd generator && mise install
# Generate colorscheme files (writes to parent directory)
cd generator && just build
# Watch mode for development (uses bacon)
cd generator && just watch
# Run generator without output (for testing)
cd generator && just debug
# Run tests
cd generator && just test
# Format code
cd generator && just fmt
# Run linter (strict mode with format check)
cd generator && just lint
# Build release binary
cd generator && just release
# Run all checks (lint, test)
cd generator && just checkMain Components:
generator/src/main.rs- CLI entry point, file writersgenerator/src/highlight.rs- All highlight group definitions (~821 lines)generator/src/conv.rs- Color conversion utilities (hex→LAB→cterm)generator/src/lib.rs- Module exports
Color Conversion Pipeline:
Hex (#rrggbb) → LAB color space → 256-color terminal code
Key Features:
- Uses Delta E 2000 algorithm for perceptually accurate color matching
- 256-color palette pre-computed in
lazy_static - HSV manipulation utilities:
hue(),saturate(),darken(),lighten()
Core Data Structures:
pub struct Color {
pub gui: String, // Hex color
pub cterm: String, // 256-color code
}
pub struct Highlight {
pub name: &'static str,
pub fg: ColorName,
pub bg: ColorName,
pub sp: ColorName, // Special/underline color
pub attr: HighlightAttr, // Bold, Italic, etc.
pub scope: HighlightScope, // All, Nvim, Nvim080OrLater
}Uses macro-based DSL in highlight.rs:
hi!("Normal", mainfg, mainbg, -, -, -);
hi!("Comment", commentfg, -, -, None, -);Categories:
- Basic Vim highlights (Normal, Comment, etc.)
- Treesitter semantic tokens
- LSP highlights
- Plugin integrations (50+ plugins)
The Writer struct generates three files:
write_colorscheme()→colors/dogrun.vim(main colorscheme)write_lightline()→autoload/lightline/colorscheme/dogrun.vimwrite_clap()→autoload/clap/themes/dogrun.vim
- Add highlight groups to
generator/src/highlight.rs - Use the
hi!()macro with appropriate color names - Run
cd generator && make build - Test in Neovim/Vim with the plugin installed
- Update plugin list in README.md
- Locate color definitions in
generator/src/highlight.rs- Base colors defined at top (e.g.,
mainbg,mainfg) - Derived colors use
saturate(),darken(), etc.
- Base colors defined at top (e.g.,
- Modify color values or relationships
- Run generator:
cd generator && make build - Verify changes in Vim/Neovim
# 1. Generate files
cd generator && make build
# 2. Check git diff to verify expected changes
git diff colors/dogrun.vim
git diff autoload/lightline/colorscheme/dogrun.vim
git diff autoload/clap/themes/dogrun.vim
# 3. Test in Neovim/Vim
nvim -c "colorscheme dogrun"GitHub Actions workflow validates:
- Code formatting (
cargo fmt) - Linting with clippy (
-D warningsstrict mode) - Release build succeeds
- Tests pass (
cargo test) - Generated files are up-to-date - fails if generator produces different output than committed files
Important: Always run make build and commit generated files before pushing.
Source Files (edit these):
generator/src/main.rs- Generator logicgenerator/src/highlight.rs- Color scheme definitionsgenerator/src/conv.rs- Color utilitiesgenerator/Cargo.toml- Rust dependencies
Generated Files (do not edit directly):
colors/dogrun.vim- Main colorscheme (501 lines)autoload/lightline/colorscheme/dogrun.vim- lightline themeautoload/clap/themes/dogrun.vim- vim-clap theme
Configuration:
.github/workflows/ci.yaml- CI pipelinegenerator/justfile- Build commands (task runner)generator/mise.toml- Development tool management (just, bacon)term/dogrun.itermcolors- iTerm2 theme
Rust Crates:
clap2.33.0 - CLI argument parsingtint1.0.0 - Color manipulationlazy_static1.4.0 - Static initializationdelta_e0.2 - Perceptual color difference (CIE Delta E 2000)lab0.7.2 - LAB color space conversions
- Perceptually accurate color matching (not Euclidean RGB distance)
- Consistent brightness across color pairs for readability
- Semantic color assignment:
- Purple/Blue: keywords, statements
- Green: strings
- Cyan: constants
- Yellow/Beige: types
- Pink/Magenta: special characters
- High contrast for accessibility
- Generator-based for maintainability and consistency