Grep-based Java navigation for Neovim. No LSP, no jdtls, no java_home wrangling —
just ripgrep and Java's file-naming convention.
gdon a class name: jumps straight toClassName.java(Java convention: one public type per file, named after it). On a method/field, greps for the declaration and jumps if there's exactly one match, otherwise opens a quickfix list.gr: lists every whole-word occurrence of the identifier under the cursor (declaration + call sites) in the quickfix list. Cycle with:cnext/:cprev.
Both keymaps are buffer-local and only set for filetype=java.
- Neovim >= 0.9
- ripgrep (
rg) on$PATH
Plug 'MrTpat/java-nav.nvim'Optional, call anywhere in your config:
require('java-nav').setup({
root_markers = { '.git', 'pom.xml', 'build.gradle', 'build.gradle.kts', 'settings.gradle' },
})- Project root: nearest ancestor directory containing one of
root_markers. gdon a capitalized word:rg --files -g 'Word.java' <root>.gdfallback /gr:rg --type java --vimgrepwith a declaration or word-boundary pattern.
This is pattern matching, not a parser — overloaded methods and generic-heavy signatures can produce noisier results than a real LSP. It trades that for zero setup and no background language server.