canola-git: git-aware hidden file filtering #3

Closed
opened 2026-03-20 17:34:30 +00:00 by barrettruth · 0 comments
barrettruth commented 2026-03-20 17:34:30 +00:00

Problem

canola.nvim's default hidden file filter only matches dotfile patterns (^%.). Users who work in git repos want smarter filtering: show tracked dotfiles, hide ignored non-dotfiles. This was previously done inline in user configs via is_hidden_file + git ls-files/git ls-tree, but that approach doesn't scale and requires runtime setter calls.

Solution

Add a canola-git extension to canola-collection that provides git-aware hidden file filtering. On CanolaEnter/refresh, it runs git ls-files --ignored --exclude-standard --others --directory and git ls-tree HEAD --name-only for the current directory, caches the results per-directory, and overrides config._is_hidden_file with a function that:

  • For dotfiles: hides them only if they're not tracked
  • For non-dotfiles: hides them only if they're git-ignored

The cache is invalidated on refresh. Configuration via vim.g.canola_git.

## Problem canola.nvim's default hidden file filter only matches dotfile patterns (`^%.`). Users who work in git repos want smarter filtering: show tracked dotfiles, hide ignored non-dotfiles. This was previously done inline in user configs via `is_hidden_file` + `git ls-files`/`git ls-tree`, but that approach doesn't scale and requires runtime setter calls. ## Solution Add a `canola-git` extension to canola-collection that provides git-aware hidden file filtering. On `CanolaEnter`/refresh, it runs `git ls-files --ignored --exclude-standard --others --directory` and `git ls-tree HEAD --name-only` for the current directory, caches the results per-directory, and overrides `config._is_hidden_file` with a function that: - For dotfiles: hides them only if they're **not** tracked - For non-dotfiles: hides them only if they're git-ignored The cache is invalidated on refresh. Configuration via `vim.g.canola_git`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/canola-collection#3
No description provided.