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

Closed
opened 2026-09-21 17:53:30 +00:00 by barrettruth · 0 comments
Owner

Original issue: barrettruth/canola-collection#3
Original author: barrettruth
Original date: 2026-03-20T17:34:30Z

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.

> Original issue: barrettruth/canola-collection#3 > Original author: `barrettruth` > Original date: 2026-03-20T17:34:30Z ## 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 description provided.