feat: support user templates and subcommands #4

Merged
CoderLambert merged 11 commits from feat/user-template-dirs into main 2026-05-20 20:27:14 +08:00
CoderLambert commented 2026-05-20 19:05:02 +08:00 (Migrated from github.com)

Summary

  • Add template_dirs config with default user template locations under Neovim config/data paths.
  • Support templates.user as string[] for selected user templates or true for all discovered user templates.
  • Support user template JSON files as either an array of presets or an object with presets[].
  • Add :ProjectSearch templates to inspect builtin/user template directories, active templates, and discovered user templates.
  • Include template information in :ProjectSearch health.
  • Add docs/user-templates.md with usage examples.
  • Add a stable single-command interface: :ProjectSearch <subcommand>.
  • Keep old command aliases after plugin load for backward compatibility.
  • Fix command help output to include help.
  • Deduplicate discovered user templates by template name so templates.user = true does not load the same name twice.
  • Update user template docs to use the new subcommand style.

Single command mode

After this PR, lazy.nvim users only need:

cmd = { "ProjectSearch" }

Subcommands:

:ProjectSearch
:ProjectSearch edit
:ProjectSearch init
:ProjectSearch init!
:ProjectSearch reset
:ProjectSearch path
:ProjectSearch validate
:ProjectSearch reload
:ProjectSearch templates
:ProjectSearch health
:ProjectSearch help

Notes

User templates are read only during rule initialization/reset. Opening the picker still uses the cached project rules file and does not scan template directories.

## Summary - Add `template_dirs` config with default user template locations under Neovim config/data paths. - Support `templates.user` as `string[]` for selected user templates or `true` for all discovered user templates. - Support user template JSON files as either an array of presets or an object with `presets[]`. - Add `:ProjectSearch templates` to inspect builtin/user template directories, active templates, and discovered user templates. - Include template information in `:ProjectSearch health`. - Add `docs/user-templates.md` with usage examples. - Add a stable single-command interface: `:ProjectSearch <subcommand>`. - Keep old command aliases after plugin load for backward compatibility. - Fix command help output to include `help`. - Deduplicate discovered user templates by template name so `templates.user = true` does not load the same name twice. - Update user template docs to use the new subcommand style. ## Single command mode After this PR, lazy.nvim users only need: ```lua cmd = { "ProjectSearch" } ``` Subcommands: ```vim :ProjectSearch :ProjectSearch edit :ProjectSearch init :ProjectSearch init! :ProjectSearch reset :ProjectSearch path :ProjectSearch validate :ProjectSearch reload :ProjectSearch templates :ProjectSearch health :ProjectSearch help ``` ## Notes User templates are read only during rule initialization/reset. Opening the picker still uses the cached project rules file and does not scan template directories.
Sign in to join this conversation.