feat: first-class template file support #259
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
barrettruth/cp.nvim#259
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Every competitive programmer uses a personal template (standard library includes, macros, typed aliases, I/O optimization). cp.nvim's
setup_codehook lets users insert template content programmatically, but it requires writing Lua code — a higher bar than pointing to a file. Tools like cf-tool and competitest.nvim support a simpletemplate_pathstring per language.Proposed solution
Add a
templatekey per language in the language config:On new problem file creation (when the file does not yet exist), read the template file and write it as the initial buffer content, performing token substitution for
{problem},{contest},{platform},{date}.This is additive — the existing
setup_codehook continues to work for users who need programmatic setup. The template file path is the simple, common case.Alternatives considered
Keeping the
setup_codehook as the only mechanism. This works but the onboarding friction is higher than a simple file path, especially for new users following the README.