nvim exclude - #372
Conversation
…enable Zsh integration for zoxide
…f nvim-pack-lock.json
📝 WalkthroughSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThe changes refactor Treefmt configuration from individual enable flags to a TOML-based approach, remove Neovim plugin sync lock file mutations from the Makefile, add shell integration options for Zoxide, and exclude the Neovim lock file from JSON formatting. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~35 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the project's formatting and shell integration setup. It specifically addresses issues related to the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Mesa DescriptionTL;DRImproved handling of Neovim pack lock files ( What changed?
Description generated by Mesa. Update settings |
There was a problem hiding this comment.
Code Review
This pull request introduces a series of fixes and refactorings primarily related to Neovim configuration and code formatting. The exclusion of the nvim-pack-lock.json file from the JSON formatter is a good move, allowing for the removal of a complex and platform-dependent script from the Makefile. The other changes, such as adding a newline to the lock file, enabling more shell integrations for zoxide, and refactoring the treefmt configuration in flake.nix, are all positive improvements. My review includes one suggestion to simplify the new treefmt settings logic in flake.nix for better readability and maintainability.
| treefmtSettings = lib.recursiveUpdate treefmtToml { | ||
| formatter = { | ||
| nix = (treefmtToml.formatter.nix or { }) // { | ||
| command = lib.getExe pkgs.nixfmt-rfc-style; | ||
| }; | ||
| biome = (treefmtToml.formatter.biome or { }) // { | ||
| command = lib.getExe pkgs.biome; | ||
| }; | ||
| json = (treefmtToml.formatter.json or { }) // { | ||
| command = lib.getExe pkgs.jsonfmt; | ||
| }; | ||
| shell = (treefmtToml.formatter.shell or { }) // { | ||
| command = lib.getExe pkgs.shfmt; | ||
| }; | ||
| }; | ||
| }; |
There was a problem hiding this comment.
The logic for constructing treefmtSettings can be simplified. Since you are using lib.recursiveUpdate, you don't need to manually merge each formatter's attributes with (treefmtToml.formatter.<name> or { }) // { ... }. The recursiveUpdate function will handle merging the command attribute into the existing formatter definitions from treefmt.toml correctly.
Simplifying this will make the code more concise and easier to read.
treefmtSettings = lib.recursiveUpdate treefmtToml {
formatter = {
nix.command = lib.getExe pkgs.nixfmt-rfc-style;
biome.command = lib.getExe pkgs.biome;
json.command = lib.getExe pkgs.jsonfmt;
shell.command = lib.getExe pkgs.shfmt;
};
};
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
flake.nix (1)
184-192: Hybrid configuration approach works but may benefit from a comment.Some formatters use
programs.*.enable(stylua, taplo, yamlfmt) while others come from the TOML-basedsettings. This is valid but could be confusing for future maintainers.Consider adding a brief comment explaining the split:
treefmt = { projectRootFile = "flake.nix"; + # stylua, taplo, yamlfmt use treefmt-nix built-in definitions + # nix, biome, json, shell are configured via treefmt.toml programs = { stylua.enable = true; taplo.enable = true; yamlfmt.enable = true; }; settings = treefmtSettings; };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (5)
Makefile(0 hunks)flake.nix(3 hunks)home-manager/programs/neovim/nvim-pack-lock.json(1 hunks)home-manager/programs/zoxide/default.nix(1 hunks)treefmt.toml(1 hunks)
💤 Files with no reviewable changes (1)
- Makefile
🧰 Additional context used
📓 Path-based instructions (12)
**/*.nix
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.nix: Use nixfmt for formatting all Nix files
Document complex configurations with comments in Nix files
**/*.nix: Use 2 spaces for indentation in Nix files
Keep line length under 100 characters in Nix files
Sort attribute sets alphabetically in Nix files
Use consistent spacing around operators in Nix files
Format lists and sets consistently in Nix filesUse treefmt.toml for formatting Nix files
**/*.nix: UsemkOptionfor configurable options in Nix modules
Implement proper typing for all options in Nix modules
Follow the Nix expression language style guide
Files:
home-manager/programs/zoxide/default.nixflake.nix
**/default.nix
📄 CodeRabbit inference engine (CLAUDE.md)
Use
default.nixfiles for module exports
Files:
home-manager/programs/zoxide/default.nix
home-manager/programs/*/default.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Program configurations should be located in
home-manager/programs/<name>/and use home-manager's built-in modules when available
Files:
home-manager/programs/zoxide/default.nix
home-manager/programs/**/default.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Program configurations must include all necessary dependencies in their configuration
Files:
home-manager/programs/zoxide/default.nix
home-manager/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
home-manager/**/*.nix: Use typed options whenever possible in Nix configurations
Document all configuration options in Nix modules and programs
Follow home-manager's module structure and keep configurations modular
Use proper indentation and formatting in Nix configuration files
Files:
home-manager/programs/zoxide/default.nix
home-manager/programs/**/*.nix
📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)
Follow program-specific best practices in program configuration files
Program configurations in
home-manager/programs/should be organized by program name, include all necessary dependencies, usehome.packagesfor package installations, and useprograms.<name>when available in home-manager
Files:
home-manager/programs/zoxide/default.nix
**/*.{json,yaml,yml,toml}
📄 CodeRabbit inference engine (.cursor/rules/formatting.mdc)
**/*.{json,yaml,yml,toml}: Use consistent indentation (2 spaces) in configuration files
Sort keys alphabetically when possible in configuration files
Use clear, descriptive names in configuration files
Files:
treefmt.tomlhome-manager/programs/neovim/nvim-pack-lock.json
**/*.{yaml,yml,toml}
📄 CodeRabbit inference engine (.cursor/rules/formatting.mdc)
Add comments for complex configurations
Files:
treefmt.toml
**/*.{js,ts,jsx,tsx,json}
📄 CodeRabbit inference engine (CLAUDE.md)
Use Biome with 2-space indentation, 80-character line width, double quotes, and trailing commas (ES5) for JSON/JavaScript/TypeScript files
Files:
home-manager/programs/neovim/nvim-pack-lock.json
**/*.{js,jsx,ts,tsx,json}
📄 CodeRabbit inference engine (.cursor/rules/formatting.mdc)
**/*.{js,jsx,ts,tsx,json}: Format JavaScript/TypeScript/JSON files using Biome with 2-space indentation and 80 character line width
Enable Biome linter with recommended rules for JavaScript/TypeScript/JSON files
Files:
home-manager/programs/neovim/nvim-pack-lock.json
**/*.{js,jsx,ts,tsx,json,jsonc,md}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Use Biome for code formatting as configured in biome.json
Files:
home-manager/programs/neovim/nvim-pack-lock.json
flake.nix
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Maintain flake.nix as the main Nix configuration with proper structure
Always pin package versions in
flake.lock
Files:
flake.nix
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Applies to **/*.nix : Use treefmt.toml for formatting Nix files
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/**/*.nix : Follow program-specific best practices in program configuration files
Applied to files:
home-manager/programs/zoxide/default.nixflake.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Document all configuration options in Nix modules and programs
Applied to files:
home-manager/programs/zoxide/default.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Applies to **/*.nix : Use treefmt.toml for formatting Nix files
Applied to files:
treefmt.tomlflake.nix
📚 Learning: 2025-11-25T09:34:23.224Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T09:34:23.224Z
Learning: Applies to **/*.{sh,bash} : Use shfmt with 2-space indentation for shell scripts
Applied to files:
treefmt.toml
📚 Learning: 2025-11-25T09:34:23.224Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T09:34:23.224Z
Learning: Applies to **/*.nix : Use nixfmt for formatting all Nix files
Applied to files:
treefmt.tomlflake.nix
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/programs/**/*.nix : Program configurations in `home-manager/programs/` should be organized by program name, include all necessary dependencies, use `home.packages` for package installations, and use `programs.<name>` when available in home-manager
Applied to files:
treefmt.toml
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Applies to flake.nix : Maintain flake.nix as the main Nix configuration with proper structure
Applied to files:
flake.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Document all major changes in Nix configurations
Applied to files:
flake.nix
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Test configurations before committing using `nix flake check` and `home-manager build --show-trace`
Applied to files:
flake.nix
📚 Learning: 2025-11-25T09:34:23.224Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T09:34:23.224Z
Learning: Prefer Nix packages over external package managers
Applied to files:
flake.nix
📚 Learning: 2025-11-25T09:34:23.224Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T09:34:23.224Z
Learning: Applies to nix-darwin/**/*.nix : Use Homebrew only for macOS-specific applications
Applied to files:
flake.nix
📚 Learning: 2025-11-25T09:34:32.423Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/formatting.mdc:0-0
Timestamp: 2025-11-25T09:34:32.423Z
Learning: Applies to **/*.nix : Format lists and sets consistently in Nix files
Applied to files:
flake.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Applies to **/*.{js,jsx,ts,tsx,json,jsonc,md} : Use Biome for code formatting as configured in biome.json
Applied to files:
flake.nix
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: Agent
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Mesa Review
- GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
- GitHub Check: e2e-run (MacOS, macos-latest)
- GitHub Check: e2e-run (NixOS, ubuntu-latest)
- GitHub Check: nix-nixos
- GitHub Check: nix-linux
- GitHub Check: docker-build-push (linux/arm64, arm64, ubuntu-24.04-arm)
- GitHub Check: docker-build-push (linux/amd64, amd64, ubuntu-latest)
- GitHub Check: nix-darwin
- GitHub Check: lua-hammerspoon
- GitHub Check: lua-neovim
🔇 Additional comments (4)
treefmt.toml (1)
14-14: LGTM! Excluding auto-generated lock files from formatting is appropriate.This prevents the formatter from modifying machine-generated content that should remain stable for reproducibility.
home-manager/programs/neovim/nvim-pack-lock.json (1)
177-177: LGTM! Adding trailing newline follows POSIX text file conventions.Combined with the treefmt exclusion, this lock file will now maintain a consistent format without being modified by formatters.
home-manager/programs/zoxide/default.nix (1)
5-7: LGTM! Expanding zoxide integration to Bash and Zsh is a sensible addition.The shell integrations are properly configured using home-manager's built-in module options, and the attributes are sorted alphabetically.
flake.nix (1)
155-171: Formatter names are correctly synchronized between treefmt.toml and flake.nix.The verification confirms that both
treefmt.tomlandflake.nixdefine/reference the identical set of formatters: biome, json, nix, and shell. The implementation is sound—using(treefmtToml.formatter.nix or { })provides safe fallback handling if a formatter section is missing from the TOML. No synchronization issues exist in the current state.
There was a problem hiding this comment.
Pull request overview
This PR improves the handling of Neovim's pack lock file by excluding it from JSON formatting, and enhances zoxide shell integration support.
Key Changes:
- Migrated treefmt configuration from program-specific enables to a hybrid approach using TOML-based settings with Nix command path overrides
- Added exclusion for nvim-pack-lock.json in the JSON formatter to preserve its auto-generated format
- Removed manual newline management logic from Makefile, simplifying the Neovim sync process
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| treefmt.toml | Added nvim-pack-lock.json to the JSON formatter's exclude list to prevent formatting of the auto-generated lock file |
| home-manager/programs/zoxide/default.nix | Enabled Bash and Zsh integration for zoxide alongside existing Fish integration |
| home-manager/programs/neovim/nvim-pack-lock.json | Added proper newline at end of file |
| flake.nix | Refactored treefmt configuration to read from treefmt.toml and override command paths using lib.getExe for better path resolution |
| Makefile | Removed complex platform-specific sed commands for managing nvim-pack-lock.json newlines, simplified by excluding file from formatting instead |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Performed full review of 17d5b2a...b5f91d2
Analysis
-
Configuration Duplication & Increased Maintenance Burden: The changes introduce redundancy between flake.nix and treefmt.toml, creating a dual-source-of-truth problem where formatter configurations must be manually kept in sync across two files.
-
Inconsistent Formatter Configuration Patterns: The PR creates an architecturally inconsistent codebase with some formatters using explicit command paths while others use the simple enable flags pattern, making it unclear which approach future contributors should follow.
-
Incomplete Lock File Strategy: While nvim-pack-lock.json is excluded from formatting, other lock files in the repository (flake.lock, bun.lock) aren't handled similarly, suggesting an incomplete architectural consideration of lock file management.
-
Unnecessary Complexity: The flake.nix refactoring introduces significant complexity (manual parsing and overrides) to solve a problem that could be addressed with just the treefmt.toml exclusion that was already implemented.
Tip
Help
Slash Commands:
/review- Request a full code review/review latest- Review only changes since the last review/describe- Generate PR description. This will update the PR body or issue comment depending on your configuration/help- Get help with Mesa commands and configuration options
5 files reviewed | 1 comments | Edit Agent Settings • Read Docs
| }; | ||
| overlays = (import ./overlays) { inherit inputs; }; | ||
| }; | ||
| treefmtToml = builtins.fromTOML (builtins.readFile ./treefmt.toml); |
There was a problem hiding this comment.
This approach introduces significant architectural complexity. You're reading treefmt.toml, parsing it, then overriding commands manually with lib.recursiveUpdate. This creates duplication since treefmt.toml already defines these commands. The previous programs.jsonfmt.enable = true pattern was simpler and more maintainable. What specific problem does this refactoring solve?
Agent: 🏛 Architecture
Summary by cubic
Exclude the Neovim plugin lockfile from formatting and remove lockfile cleanup in the sync step to stop noisy diffs. Move treefmt configuration into flake.nix for consistent formatter command wiring, and enable zoxide Bash/Zsh integration.
Bug Fixes
Refactors
Written for commit b5f91d2. Summary will update automatically on new commits.