cnav (Code NAVigator) is a fast, terminal-based code navigation tool powered by ripgrep. It helps you quickly jump to functions, variables, or any symbol in your project, directly inside your favorite terminal editor.
- Lightning Fast: Powered by ripgrep for instant symbol searches.
- Interactive Selection: Browse through matches with an intuitive TUI.
- Editor Integration: Opens files directly in your favorite terminal editor.
- Tmux Support: Seamlessly integrates with tmux workflows.
- Syntax Highlighting: Highlights matched symbols in search results.
- Configurable: Supports multiple editors and customization options
- Rust (1.72 or higher)
- ripgrep
- A terminal editor (vim, nvim, nano, emacs, micro, helix, kakoune, joe)
- Optional: tmux (for tmux split support)
From Crates.io
cargo install cnavFrom source
git clone https://github.com/agace/cnav
cd cnav
cargo install --path .
cnav [OPTION] <path> <symbol>-n, --no-interactive: Open the first match directly without interactive selection-t, --tmux: Open the file in a new tmux split (when inside tmux)-e, --editor <EDITOR>: Specify the terminal editor to use-h, --help: Show help information-V, --version: Show version information
- Interactive search for a function:
cnav /path/to/project main- Open first result directly:
cnav -n src/utils calculate- Use with tmux and specific editor:
cnav -t -e nvim . my_function- j / ↓ - move down
- k / ↑ - move up
- h / ← - previous page
- l / → - next page
- Enter - open selected match
- q - quit without opening
| Editor | Line Jump Syntax |
|---|---|
| vim, nvim | vim +42 file.txt |
| nano | nano +42 file.txt |
| emacs | emacs +42 file.txt |
| micro | micro file.txt:+42 |
| helix (hx) | hx file.txt:42 |
| kakoune (kak) | kak +42 file.txt |
| joe | joe +42 file.txt |
Other editors still open, but may not support direct line jumps.
Set your preferred editor using the EDITOR environment variable:
export EDITOR="nvim"This project is licensed under the MIT License. See the LICENSE file for details.