Make your Git commit messages clean, consistent, and conventional—right inside Neovim!

When it comes to managing a codebase, well-written commit messages are as important as clean code. They provide context, help with debugging, and assist collaborators (and your future self) in understanding the evolution of your project. That's where tools like Commitizen shine — guiding you through the process of writing conventional, standardized commits with ease.

If you're using NvChad, a modern and minimal Neovim configuration, integrating cz into your workflow can drastically improve your Git hygiene without ever leaving the comfort of your editor.

This guide explores multiple best-practice approaches to integrating the cz CLI into NvChad — from simple key mappings to plugin-powered terminals. Whether you're a minimalist or love your floating terminals, there's a setup here for you.

📌 Prerequisites

Before we begin, make sure you've set up the necessary environment.

✅ 1. Install Node.js and npm

Commitizen is a Node.js-based CLI tool.

node -v
npm -v

If not installed, get Node.js from nodejs.org or use your OS package manager.

✅ 2. Install Commitizen Globally

npm install -g commitizen

Verify the installation with:

cz

This should open the interactive Commitizen prompt in your terminal.

🧠 Why Use Commitizen in Neovim?

Integrating cz directly into Neovim with NvChad offers several advantages:

  • 🧘‍♂️ Editor-focused workflow – no context switching
  • 📋 Standardized commits – enforced structure like Conventional Commits
  • 🚫 Fewer mistakes – no more malformed commit messages
  • ⚡ Speed and efficiency – one keypress to commit

If you’re already using Neovim as your IDE, why not make Git commits as smooth as writing code?

📁 Working with NvChad

NvChad encourages a modular configuration approach. Your custom config lives in:

~/.config/nvim/lua/custom/

You'll mainly edit:

  • chadrc.lua – main config for mappings, UI tweaks, etc.
  • mappings.lua – for custom key mappings
  • plugins/ – for managing additional plugins like toggleterm.nvim

🛠️ Method 1: Lightweight Floating Terminal (Best for Simplicity)

This method uses Neovim's native terminal inside a horizontal split — simple, fast, and dependency-free.

🔧 Setup

  1. Add this function in mappings.lua or chadrc.lua:
local function commitizen_commit()
  vim.cmd("belowright split | resize 15 | terminal cz")
  end
  1. Map the function to a key, like cz:
local map = vim.keymap.set
  map("n", "cz", commitizen_commit, { desc = "Commit using Commitizen" })

✅ Result:

Hit cz and a split terminal will open at the bottom, running the cz prompt. Super clean and integrates naturally into Neovim.

🧩 Method 2: Enhanced Popup Terminal with ToggleTerm (Best UI)

Want a floating terminal popup with auto-toggle and minimal distractions? Enter toggleterm.nvim.

📦 Step-by-step

  1. Add toggleterm.nvim as a custom plugin in custom/plugins/commitizen.lua:
return {
    {
      "akinsho/toggleterm.nvim",
        config = function()
          require("toggleterm").setup()

          local Terminal = require("toggleterm.terminal").Terminal
          local cz_term = Terminal:new({
              cmd = "cz",
              hidden = true,
              direction = "float",
              })

      vim.keymap.set("n", "cz", function()
          cz_term:toggle()
          end, { desc = "Commit with Commitizen" })
        end,
    }
  }
  1. Then import it in custom/plugins/init.lua:
require("custom.plugins.commitizen")

✅ Result:

Press cz, and a sleek floating terminal opens with cz. One of the best UX enhancements you can add to your Git workflow.

🔁 Method 3: Plain Terminal Split (No Plugin, No Problem)

This method is plugin-free and even more minimalistic.

vim.keymap.set("n", "cz", function()
    vim.cmd("split | terminal cz")
    end, { desc = "Commitizen simple split" })

✅ Result:

A quick vertical split opens up with cz, perfect if you prefer no extra configuration or dependencies.

🎨 Bonus: Command Palette Integration (NvChad Style)

NvChad includes a command palette-style menu with fuzzy searching. You can create your own custom command to make cz even more accessible.

💡 Add This to chadrc.lua:

vim.api.nvim_create_user_command("Commitizen", function()
    vim.cmd("split | terminal cz")
    end, {})

✅ Usage:

Just type :Commitizen in command mode to launch the cz prompt inside a split. Very handy for keyboard-driven users.

🧼 Pro Tip: Prevent Commit Buffers from Lingering

Sometimes, using cz will leave a .git/COMMIT_EDITMSG buffer in Neovim. While harmless, it can clutter your buffer list.

To keep things clean:

  • Use cz instead of git commit directly.
  • Set autocommands to close the buffer automatically if needed.
  • Map q to close commit message buffers quickly.

📦 Future Enhancements

  • 🤖 Integrate with gitmoji-cli for emoji-powered commits.
  • 🧠 Chain commands to auto-stage, run Commitizen, and push.
  • 🧰 Hook into lazygit.nvim and combine floating tools.
  • 📑 Add commit templates with Conventional Commits + scopes.

🧭 Summary of Methods

Method Description Best For
Floating Terminal Horizontal split terminal with cz Simple, native integration
ToggleTerm Plugin Popup-style floating terminal Best UX, clean UI
Plain Terminal Split Minimal config, vertical split Fast and dependency-free
Command Palette Command-mode triggered cz Keyboard-driven workflows

✅ Final Thoughts

You don’t need to leave Neovim to make high-quality, conventional commits. Whether you're team minimalism or love a polished UI, integrating cz into NvChad will save you time, enforce best practices, and make your Git history shine.

This guide offers multiple pathsgg — pick one that fits your workflow or try them all. Either way, your future team (or self) will thank you.