8000 GitHub - ansromanov/mantis: A fast terminal file tree viewer with syntax highlighting, markdown rendering, fuzzy search, and mouse support. · GitHub
[go: up one dir, main page]

Skip to content
ansromanovPublic

About

A fast terminal file tree viewer with syntax highlighting, markdown rendering, fuzzy search, and mouse support.

Resources

Contributing

Stars

6 stars

Watchers

0 watching

Forks

Latest commit

 

History

905 Commits

Folders and files

Repository files navigation

mantis

An instant terminal code browser.

Linux / macOS:

curl -fsSL https://raw.githubusercontent.com/ansromanov/mantis/main/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/ansromanov/mantis/main/install.ps1 | iex

mantis is a fast, lightweight tree viewer for reading code in your terminal: syntax highlighting, fuzzy search, and code folding in one small binary. No config required. Built with ratatui.

mantis

▶ Watch the 40-second demo · or asciinema play media/demo.cast

mantis      # open the current directory and start browsing

That's it — no setup step. Press F1 for help (or ?), Ctrl+c to quit.

Why mantis?

mantis does one job: move through a codebase and read it, fast. It opens in milliseconds, needs zero config, and stays out of your way. It is not an editor — when you want to change something, press Ctrl+e to jump into your $EDITOR.

mantis Vim / Neovim VS Code Zed Sublime Text
Interface Terminal (TUI) Terminal (TUI) GUI (Electron) GUI (native/GPU) GUI (native)
Footprint Single ~MB binary Light core Hundreds of MB + RAM Native app (tens of MB) Native app (tens of MB)
Setup to be useful Zero — just run mantis Hours of config & plugins Install + extensions + indexing Minimal Minimal
Starts in Milliseconds Fast (slower with a big config) Seconds Fast Fast
Fuzzy + full-text search Built in Plugins (fzf/telescope) Built in Built in Built in
Syntax highlighting Built in Built in Built in Built in Built in
Price Free / OSS Free / OSS Free Free / OSS Paid (free eval)

mantis is the only row that's a read-only viewer — that's the whole pitch. Where the editors edit, mantis just gets you in, around, and back out fast, in any terminal.

What mantis is not

Be clear about the trade-offs before you install:

  • Not an editor. No insert mode, no buffers, no saving — it reads, it doesn't write. Editing means handing the file to $EDITOR.
  • No LSP / IntelliSense. No autocomplete, go-to-definition, or refactoring. It highlights syntax and shows a lightweight symbol outline (Rust) and ruff diagnostics (Python); it doesn't understand your code beyond that.
  • No integrated terminal, debugger, or task runner. It's a viewer, not an IDE.
  • Fewer batteries. A deliberately small feature set — less out-of-the-box than VS Code.
  • Terminal-bound. A TUI in your terminal, not a GUI; icons need a Nerd Font.

If you want a fast, throwaway way to explore a repo, read a file, or skim a project without launching a heavyweight editor, that's exactly the gap mantis fills.

Features

Navigation

  • Tree navigation by keyboard or mouse, respecting .gitignore
  • Breadcrumb path bar; change root, go up a directory, double-click to descend
  • Project tabs / workspaces, bookmarks, recent files (Ctrl+O), right-click context menus
  • Code folding (Space) — language-aware regions, ready on the first frame (Rust, Go, Python, JS/TS, CSS, shell, HCL, SQL, YAML, TOML/INI, JSON, templates)

Search

  • Fuzzy file-name search (Ctrl+T) — fzf-style, as you type
  • Full-text content search (Ctrl+F) across the tree
  • In-file search (/), go-to-line (Ctrl+G), symbol outline (O, Rust)

Viewing & rendering

  • Syntax highlighting for a wide range of languages
  • Built-in markdown rendering — headings, lists, tables, code blocks; M toggles raw
  • JSON pretty-print and path queries, CSV/TSV tables, JSON Lines
  • Python diagnostics via ruff (if installed) and Kubernetes manifest facts in the status bar
  • Word wrap, line numbers, and a status bar (line, language, scroll, encoding)

Git

  • Status-colored tree, working-tree diffs (unified or side-by-side), file history, per-line and full-file blame, worktree switcher, and a git mode that scopes everything to changed files (Ctrl+D)

Productivity

  • Command palette (Ctrl+P) — fuzzy-find every action with its keybinding
  • Open in your $EDITOR (Ctrl+e) and drop back into mantis when you're done
  • Auto-reload on disk change; session persistence (expanded dirs, open file, scroll) restored on restart, cached outside the repo
  • Pager mode: git diff | mantis --language diff

Customization

  • Live theme switching — built-in presets, fully recolorable
  • Remappable keybindings and configurable layout via a simple TOML file
  • Nerd Font file-type icons (optional), full mouse support

Install

The one-liners above (no Rust toolchain required) download the prebuilt binary for your platform, verify its checksum, and install it onto your PATH. You can also download a binary by hand from the releases page (check it against SHA256SUMS), or on macOS / Linux use Homebrew:

brew tap ansromanov/mantis https://github.com/ansromanov/mantis
brew install mantis

From source (Rust toolchain required; one crate, no build step beyond cargo):

cargo install --git https://github.com/ansromanov/mantis
# or
git clone https://github.com/ansromanov/mantis.git
cd mantis && cargo build --release   # binary at target/release/mantis

See the installation docs for prebuilt binaries, Windows, and checksum verification.

Usage

mantis                          # view the current directory
mantis path/to/dir              # view a specific directory
mantis file.md                  # open a file directly
mantis --completions bash       # generate bash completions
mantis --print-man-page         # print the man page (mantis.1)
mantis --language rust < file   # highlight piped stdin as rust
mantis --update                 # self-update to the latest release

Press F1 for in-app help (or ?), and Ctrl+c to quit. For the full keybinding list and every action name, see the Usage & Keybindings guide — or press Ctrl+P in-app to fuzzy-find any action with its binding.

Shell completions for bash, zsh, fish, and PowerShell are generated automatically by the install script and Homebrew formula. Alternatively:

mantis --completions bash > /etc/bash_completion.d/mantis
mantis --completions zsh > /usr/local/share/zsh/site-functions/_mantis
man mantis    # view the man page

Documentation

See example.md for a document that exercises the built-in markdown renderer (press M to toggle raw/rendered).

Development

just build     # debug build
just run .     # run against the current directory
just test      # run the test suite
just clippy    # lint

Contributing

Contributions are welcome! See CONTRIBUTING.md for how to build, test, and submit a pull request, plus the branch/commit conventions and what CI checks. Project conventions in depth live in AGENTS.md.

License

GPL-3.0-or-later © 5AF4 Andrei Romanov

About

A fast terminal file tree viewer with syntax highlighting, markdown rendering, fuzzy search, and mouse support.

Resources

Contributing

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0