README.md

July 23, 2025 ยท View on GitHub

template.nvim

License People Stars Forks Watches Last Updated

Ready to go Neovim template ๐Ÿ—๏ธโœˆ๏ธ

template.nvim in action
template.nvim in action

template.nvim is a neovim plugin that allows neovim users to <action>.

โœจ Features

  • Modern Plugin Architecture: Ready-to-go Neovim plugin template with best practices
  • Unified Command System: Modern command interface with tab completion support
  • Type Safety: Comprehensive type annotations using LSP-compatible @class and @param
  • DRY Code Patterns: Reusable helper functions and modular design
  • CI/CD Ready: Lint and test GitHub Actions included
  • Auto Documentation: GitHub Action to auto-generate vimdocs
  • Professional README: Complete template with modern formatting
  • Integration Ready: Works seamlessly with mkrepo

โšก Setup

โš™๏ธ Requirements

  • Latest version of neovim

๐Ÿ’ป Installation

-- Lazy
{
    '2kabhishek/template.nvim',
    cmd = { 'Template' },
    keys = { '<leader>th', '<leader>tH', },
    -- Add your custom configs here, keep it blank for default configs (required)
    opts = {},
    -- Use this for local development
    -- dir = '~/path-to/template.nvim',
},

๐Ÿš€ Usage

  1. Fork the template.nvim repo
  2. Update the plugin name, file names etc, change template to your-plugin-name
  3. Add the code required for your plugin:
    • Code entrypoint: template.lua - Main setup function
    • User configs: config.lua - Configuration with type annotations
    • Commands: commands.lua - Modern command system with completion
    • Plugin logic: module.lua - Core functionality with type safety
    • Additional modules: Add more modules under modules directory as needed
  4. Command System Features:
    • Unified command interface with subcommands
    • Tab completion support for better UX
    • Reusable helper functions for DRY code
    • Comprehensive type annotations for better development experience
  5. Add test code to the tests directory
  6. Update the README with your plugin's functionality
  7. Tweak the docs action file to reflect your plugin name, commit email and username
    • Generating vimdocs needs read and write access to actions (repo settings > actions > general > workflow permissions)

Configuration

template.nvim can be configured using the following options:

template.setup({
    name = 'template.nvim', -- Name to be greeted, 'World!' by default
    add_default_keybindings = true, -- Whether to add default keybindings
})

Commands

template.nvim provides a unified command interface with tab completion:

  • Template greet [name] - Shows a hello message with the specified name (with tab completion)
  • Template notify [message] - Shows a notification with custom message

Keybindings

Here are the default keybindings:

KeybindingCommandDescription
<leader>thTemplate greetTemplate greet default name
<leader>tHTemplate greet NeovimTemplate greet Neovim

You can disable default keybindings by setting add_default_keybindings = false in your config.

Help

Run :help template.txt for more details.

๐Ÿ—๏ธ What's Next

Planning to add <feature/module>.

โœ… To-Do

  • Setup repo
  • Think real hard
  • Start typing

โ›… Behind The Code

๐ŸŒˆ Inspiration

template.nvim was inspired by nvim-plugin-template, I added some changes on top to make setting up a new plugin faster.

๐Ÿ’ก Challenges/Learnings

  • The main challenges were <issue/difficulty>
  • I learned about <learning/accomplishment>

๐Ÿงฐ Tooling

  • dots2k โ€” Dev Environment
  • nvim2k โ€” Personalized Editor
  • sway2k โ€” Desktop Environment
  • qute2k โ€” Personalized Browser

๐Ÿ” More Info


โญ hit the star button if you found this useful โญ

Source | Blog | Twitter | LinkedIn | More Links | Other Projects