Skip to content

PJMessi/hanger.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neovim Test Runner Plugin

Hanger.nvim is a lightweight and intuitive Neovim plugin for running and managing tests in Rust, Go, and JavaScript/TypeScript projects. Powered by Tree-sitter, it detects tests intelligently and provides a fast, editor-native workflow tailored for rapid iteration.

Run tests directly from Neovim — in the built-in terminal or a floating Zellij pane — without breaking focus. With minimal setup and simple commands, you can instantly run the test under your cursor, browse all tests in the current file, or rerun the last executed test — perfect for tight feedback loops and fast development cycles.

Features

  • 🧠 Tree-sitter powered test detection
  • 🔍 Telescope UI for discovering & running tests
  • 🚀 One-shot test execution under cursor
  • 🧪 Language support:
    • Rust (cargo test) with a custom runner
    • Go (go test, testify) with suite-aware execution
    • JavaScript (jest) with precise control
  • 🪟 Run in:
    • Neovim terminal (default)
    • Floating Zellij pane (optional)
    • tmux support coming soon

Rust Picker Go Picker

JS/Ts Picker Test Execution

Installation

Use your preferred plugin manager to install the plugin.

Using Lazy

{
    'https://github.com/pjmessi/hanger',
    lazy = false,
    cmd = { "RunTest", "ReRunTest", "RunAllTests", "ShowTests" },
    dependencies = {
      "nvim-telescope/telescope.nvim",
      "nvim-lua/plenary.nvim",
      "nvim-treesitter/nvim-treesitter",
    },
    config = function()
      require("hanger").setup({
        -- options: 'term' / 'zellij'
        output = "zellij",
        -- only valid for 'zellij' 'output'
        floating_pane = true,
      })

      vim.api.nvim_set_keymap('n', '<leader>rt', ':RunTest<CR>',
        { desc = '[R]un [T]est', noremap = true, silent = true })
      vim.api.nvim_set_keymap('n', '<leader>rrt', ':ReRunTest<CR>',
        { desc = '[R]e [R]un [T]est', noremap = true, silent = true })
      vim.api.nvim_set_keymap('n', '<leader>rat', ':RunAllTests<CR>',
        { desc = "[R]un [A]ll [T]ests", noremap = true, silent = true })
      vim.api.nvim_set_keymap('n', '<leader>st', ':ShowTests<CR>',
        { desc = '[S]how [T]ests', noremap = true, silent = true })
    end,
  }

Coming Soon

Support for additional programming languages will be added in future releases.

About

Neovim plugin to quickly run the test block where your cursor is. Very useful for quickly iterating on tests.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors