Skip to content

Latest commit

 

History

43 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

lazyrails.nvim

Neovim plugin for Ruby on Rails – focused on navigation and test running, designed for LazyVim with sensible <leader>r keybindings.

Inspired by ror.nvim by Wei Zhe. Credits are retained in the MIT License.

video.mp4

Features

Navigation helpers

Jump from any Rails file to its counterpart.
When multiple candidates exist a Snacks picker opens automatically.

From To Key
model / controller / view model <leader>rm
model / view / test controller <leader>rc
model / controller view <leader>rv
model / controller test / spec <leader>rs

Inertia + React support – when navigating to a view (<leader>rv) from a controller that uses render inertia:, the plugin resolves the matching .jsx / .tsx component under app/frontend/pages/ automatically.

Test runner

Supports both minitest (test/) and RSpec (spec/) projects.

Run specs/tests directly on the current file and results (pass ✅ / fail ❌) are shown inline in the buffer as virtual text and diagnostics.

Action Key
Run whole test file <leader>rt
Clear test results <leader>rX

RSpec requires no extra setup.
Minitest requires minitest-json-reporter and minitest 5.x (minitest 6+ is not yet compatible):

# Gemfile
gem "minitest", "~> 5.25"

group :test do
  gem "minitest-json-reporter"
end

Lint runner

Support rubocop and herb-tools

Run lint directly on the current file with inline diagnostics and pass/fail notification.

Action Key
Run lint for current file <leader>rl
Clear lint results <leader>rL

Lint behavior is file-type based:

  • *.rbbundle exec rubocop --format json
  • *.html.erbnpx --no-install @herb-tools/linter --json

Installation

lazy.nvim (recommended)

{
  "kalebhenrique/lazyrails.nvim",
  ft = { "ruby", "eruby" },
  dependencies = {
    "folke/snacks.nvim",
    "nvim-lua/plenary.nvim",
  },
  opts = {}, -- see Configuration section below
}

Configuration (optional)

require("lazyrails").setup({
  test = {
    pass_icon = "",
    fail_icon = "",
    notification = { timeout = false },
  },
  lint = {
    pass_icon = "",
    fail_icon = "",
    notification = { timeout = false },
  },
})

Optional dependencies


Keybinding reference

Key Command Description
<leader>rm RailsGoModel Go to model
<leader>rc RailsGoController Go to controller
<leader>rv RailsGoView Go to view
<leader>rs RailsGoTest Go to test / spec file
<leader>rt RailsTestRun Run test file
<leader>rX RailsTestClear Clear test results
<leader>rl RailsLintRun Run lint for current file
<leader>rL RailsLintClear Clear lint results

All keys live under the Rails group visible in which-key.

About

Neovim plugin for Ruby on Rails navigation, test, and linter helpers

Resources

Stars

11 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages