Hatch.nvim is a Neovim plugin that simplifies the coding process by automatically filling empty buffers with pre-defined file templates. With support for custom templates and features like cursor placement, coding becomes faster and more efficient. Start projects without the hassle of boilerplate code and focus on what matters—your work.
Hatch.nvim is a powerful Neovim plugin designed to enhance the coding experience by automatically inserting file templates into empty buffers, thus streamlining the development process. By leveraging pre-defined boilerplate code, this tool accelerates the initial setup for various file types, allowing developers to focus on writing code rather than repetitive setup tasks.
#cursor row:col directive, positioning the cursor precisely where coding should begin, thereby eliminating the need to navigate away from the starting point.To use Hatch.nvim, invoke the command :Hatch in an empty buffer to apply the corresponding template file. For cases where it's necessary to overwrite a non-empty buffer, the command :HatchForce can be utilized to enforce template application.
Template files are organized in either {template_directory}/custom/{file_extension} or {template_directory}/default/{file_extension}, giving precedence to the custom templates. The default template location is set to $HOME/.config/hatch.nvim/templates, where users can easily access and modify their templates.
For example, to create a GDScript template, one can define a file at {template_directory}/default/template.gd:
#cursor 1:11
class_name Foo
function _ready() -> void:
pass
function process(delta: float) -> void:
pass
This setup automatically places the cursor at Foo, enabling instant modifications.
For users who wish to integrate with formatting tools, Hatch.nvim offers flexible options to run after formatters, refining the workflow further. Configuration options are available, allowing tailoring to individual preferences, such as setting specific template directories or toggling auto command creation.
:Hatch: Apply a template to the current buffer if it is empty.:HatchForce: Force-apply a template, overwriting existing content.:HatchCloneTemplates: Clone the default template repository to the local template directory.By incorporating Hatch.nvim into the development environment, efficiency is significantly boosted, enabling an organized and rapid development workflow.
No comments yet.
Sign in to be the first to comment.