ripscope 0.2.0

Cscope-compatible code navigation for C with content-aware, atomic index updates
ripscope-0.2.0 is not a library.
Visit the last successful build: ripscope-0.0.0

Ripscope

CI Docs License: MIT OR Apache-2.0

Fast C navigation, with answers you can inspect.

Find definitions, follow callers and trace assignments in unfamiliar C. Ripscope is written in purely safe Rust and needs no compiler, preprocessor or compile database to read your source. It speaks cscope's command line and query protocol, works with Vim's built-in cscope support and cscope -Rbqk scripts, and ships integrations for Neovim and Emacs on x86-64 Linux and Windows.

$ ripscope -bk -I include          # index the C files here
$ ripscope -L -1 greet             # where is greet defined?
greet.c greet 6 void greet(const char *name)
$ ripscope -L -3 greet             # who calls it?
main.c main 5 greet("world");

Why Ripscope?

  • Fast, by a wide margin. On the Linux kernel, symbol, definition and caller lookups return in about a tenth of a millisecond, hundreds of times faster than cscope. Even against cscope -q, text searches run about 6× faster, egrep 10× and assignment searches over 70×. See the benchmarks for every search on Linux and Windows.
  • Better reading of specific C constructs. Find written increments and indexed stores, recognise ordinary split-line calls and correct mislabelled contexts. Paired fixtures and source evidence show the intended readings and the limits.
  • An index that keeps up. Only changed files are analysed again. Each update commits in one transaction, so queries keep reading a complete revision and editor searches refresh saved source changes automatically.
  • A design you can follow. The architecture guides, decisions and glossary explain how a result is obtained.
  • Exact output when needed. The opt-in JSON interface preserves path and line bytes, including spaces and non-ASCII text.

Ripscope reads written source across conditional branches. It does not expand arbitrary macros or resolve types. See the recognition limits and freshness checks.

Find callers in Vim, add and save a caller, then search again. The saved caller is already in the results.

Vim searches for the callers of greet and lists main.c line 5. A call is added at line 8 and saved, and the same search then lists lines 5 and 8.

Your editor. Your source.

Use all nine cscope searches from the command line or directly in Vim, Neovim and Emacs. Ripscope creates and manages the project index on x86-64 Linux and Windows, so you can get straight to exploring C.

Install

One step sets up Ripscope and your editor. Run the installer.

curl -fsSL https://ripscope.com/install.sh | sh        # Linux
irm https://ripscope.com/install.ps1 | iex             # Windows PowerShell

Vim then loads Ripscope by itself, and so does Neovim unless lazy.nvim manages its plugins. For Emacs, and for lazy.nvim where it finds it, the installer prints the one line to add. Or add one line to your plugin manager, which installs the executable too.

{ 'pederbe/ripscope', branch = 'release', build = ':RipscopeInstall' },   -- Neovim, lazy.nvim
Plug 'pederbe/ripscope', { 'branch': 'release', 'do': ':RipscopeInstall' }  " Vim, vim-plug
;; Emacs 30 or newer
(use-package ripscope :vc (:url "https://github.com/pederbe/ripscope" :branch "release" :lisp-dir "contrib/emacs" :rev :newest) :config (ripscope-setup))

Then open a C file in your project and search with :cs find g main in Vim, :RipscopeFind g main in Neovim, or M-. on main in Emacs. The first search indexes the project into your cache directory, and later searches see your saved edits. See installation for the details, system packages and source builds.

Use

Task Command
Build or update the index ripscope -b [-R] [-k] [-I DIR]... [FILES... | -i LIST]
Query (updates first) ripscope -L -FIELD PATTERN
Query without updating ripscope -dL -FIELD PATTERN
Editor session ripscope -l
Exact output as JSON add --json to a query or session
Check the index ripscope --verify

The index is ripscope.db, and -f INDEX names another.

Field Finds Field Finds
-0 symbol occurrences -5 text (as in cscope's line mode)
-1 definitions -6 regular expression
-2 functions called by -7 files
-3 callers -8 files including
-4 text -9 assignments

Start with the quick start. The Vim, Neovim and Emacs guides cover the editors.

Documentation

The full documentation is at ripscope.com/docs and in docs/.

Status

Ripscope 0.2.0 is the current release. It reads C only and runs on x86-64 Linux and Windows. Before 1.0, a minor version may change the index format or command-line behavior, and the changelog says when it does. Reports of wrong answers and failed setups help most.

Contributing

Bug reports, compatibility reports and pull requests are welcome. See CONTRIBUTING.md and how Ripscope is built.

License

Ripscope is licensed under either of Apache License 2.0 or MIT license, at your option. So are the editor integrations.

Ripscope is an independent project, not affiliated with cscope. Its longstanding interface and observable behavior are credited in the retained cscope notice. Third-party fixture source keeps its own copyright and license notices, listed in the evidence guide.