Find your way through huge codebases, over ssh.
sonarc is a modeless editor for code on remote machines. Ping a symbol and get its definition, references and callers back, from cscope, ctags, a language server or its own indexer. One static 4 MB binary, built to run inside tmux.
$curl -fsSL https://sonarc-dev.github.io/sonarc/install.sh | sh
No root needed; installs to ~/.local/bin. Or with Go: go install github.com/sonarc-dev/sonarc/cmd/sonarc@latest
sonarc │497 const prevSuffix = ".sonarc-prev" ▸ cmd │498 ▾ internal │499 // legacyPrevSuffix is what the editor named these copies before it was ▸ buffer │500 // renamed; Recover still restores them. ▸ filetree │501 const legacyPrevSuffix = ".keditor-prev" ▸ ignore │502 ▾ index │503 // linkAbove is the size from which a file is preserved by hard link instead of ▸ builtin │504 // by copy. Index files are either a few megabytes (file lists) or a gigabyte. ▸ cscope │505 var linkAbove int64 = 64 << 20 ▸ provider │506 ▾ rebuild │507 // Recover finishes the job of a rebuild that was killed before it could roll real_test.go │508 // back or commit, such as when the editor itself was killed. A leftover rebuild.go │509 // NAME.sonarc-prev is the last good copy: it is restored if NAME is missing rebuild_test.│510 // and discarded otherwise, since NAME is then a completed build. It is safe ▸ tags │511 // to call at any time, and Run's guard calls it before every in-place build. ▸ proc │512 func Recover(root string, names ...string) { ▸ search │513 for _, n := range names { ▸ syntax │514 live := filepath.Join(root, n) ▸ term │515 for _, prev := range []string{live + prevSuffix, live + legacyPrevSuffix} { ▸ text │516 if !exists(prev) { ▸ ui │517 continue ▸ vcs │518 } ▸ view │ references to Recover — 7 results Enter open n/p next/prev Esc close .gitignore │ internal/index/rebuild/rebuild.go:500 // renamed; Recover still restores them. LICENSE │ internal/index/rebuild/rebuild.go:507 // Recover finishes the job of a rebuild that was kille Makefile M│ internal/index/rebuild/rebuild.go:512 func Recover(root string, names ...string) { ▾ CHANGES 3 │ internal/index/rebuild/rebuild.go:531 Recover(root, names...) ? .github │ internal/index/rebuild/rebuild_test.go:232 Recover(root, "tags") M Makefile │ internal/index/rebuild/rebuild_test.go:243 Recover(root, "tags") ? install.sh │ internal/index/rebuild/rebuild_test.go:407 Recover(root, "tags") rebuild.go Ln 500, Col 1 go Tab:4 LF 634 lines 7 result(s) — builtin 3ms — Enter opens, Esc closes
Recover in sonarc's own source, with the file tree and the list of files changed since the last commit.Watch it work
Half a minute of sonarc's real screen: open a file by name, jump to a definition, list its references, jump back, then read each changed file's diff.
Soundings from a Linux kernel tree
Linux 7.2 source: 5.5 GB, 64,525 C and header files. A 4-core Ubuntu box with 3.7 GB of RAM, over ssh inside tmux 3.4, with real cscope and a real tags file.
Why sonarc
No modes
Typing inserts text. Ctrl+S saves and Ctrl+Z undoes. There is nothing to escape from and no :wq, so it works the way you already expect an editor to.
Made for tmux
tmux and screen drop Ctrl+Shift keys, so no command needs one: a Ctrl+K chord reaches everything. sonarc -doctor reads your live tmux settings and says what to change.
Scales to a kernel
A gigabyte tags file is binary-searched on disk instead of loaded. One cscope process stays resident, and the file tree reads a directory only when you open it.
What it does
- Code navigationGo to definition, peek, find references, callers, callees, assignments and includers, with a jump-back stack.
- Language servers, if installedgopls, clangd, rust-analyzer and others answer about the exact symbol under the cursor, with nothing to configure.
- Split panesTwo files side by side or stacked, or one file twice with separate cursors.
- Multiple cursorsAdd cursors down a column or at each occurrence of a word, and type at all of them.
- Project searchText and regex search across the tree through
git grep, and symbol search by name. - Changes and diffsThe files changed since the last commit sit under the tree. Select one to read its diff in place.
- Sessions that survive sshOpen files, cursors and folders are saved every few seconds, so a dropped connection loses nothing.
- Works with nothing installedWithout cscope or ctags, a built-in indexer still covers C and C++, Go and Python.
- Your keys, your wayRebind any command in keys.conf; F1 always lists what your terminal can send.
- Mouse, themes, reloadClicks and the wheel work through tmux, five themes, and files changed on disk are noticed within two seconds.
sonarc │ ⋯ ▸ cmd │ 29 29 @echo ▾ internal │ 30 30 @ls -lh $(BUILD)/$(BIN)-linux-* | awk '{print $$9, $$5}' ▸ buffer │ 31 31 @file $(BUILD)/$(BIN)-linux-* 2>/dev/null | sed 's/, BuildID.*//' || true ▸ filetree │ 32 + ▸ ignore │ 33 + ## release: static binaries for linux and macOS, amd64 and arm64, with ▾ index │ 34 + ## checksums.txt - the files a GitHub release carries and install.sh fetches ▸ builtin │ 35 + RELEASE_TARGETS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 ▸ cscope │ 36 + SHA256 := $(shell command -v sha256sum >/dev/null 2>&1 && echo sha256sum || echo 's ▸ provider │ 37 + release: ▾ rebuild │ 38 + @rm -rf $(BUILD) && mkdir -p $(BUILD) real_test.go │ 39 + @for t in $(RELEASE_TARGETS); do \ rebuild.go │ 40 + os=$${t%/*}; arch=$${t#*/}; \ rebuild_test.│ 41 + echo "building $(BIN)-$$os-$$arch"; \ ▸ tags │ 42 + GOOS=$$os GOARCH=$$arch $(GO) build -trimpath -ldflags '$(LDFLAGS)' -o $(BU ▸ proc │ 43 + done ▸ search │ 44 + cd $(BUILD) && $(SHA256) $(BIN)-* > checksums.txt ▸ syntax │ 45 + @cat $(BUILD)/checksums.txt ▸ term │ 32 46 ▸ text │ 33 47 ## install: install to GOPATH/bin for local use ▸ ui │ 34 48 install: ▸ vcs │ ⋯ ▸ view │ .gitignore │ LICENSE │ Makefile M│ ▾ CHANGES 3 │ ? .github │ M Makefile │ ? install.sh │ diff Makefile +15 −1 Enter go to line n/p next/prev change Esc close ^S save ^Q quit ^F find ^O open ^E tree ^] def ^K r refs F1 help
Is it for you?
A good fit
- You read and edit C on remote Linux machines: kernels, drivers, firmware, embedded.
- You live in ssh and tmux and want an editor that behaves there.
- You can't install much: no root, old glibc, Alpine, air-gapped boxes.
Not for you, if you need
- Plugins or scripting.
- Vim-style modal editing.
- A debugger, or staging and committing from the editor.
The keys you need on day one
F1 lists every key your terminal can actually send.