{"id":51861402,"url":"https://github.com/mlang/caret","last_synced_at":"2026-07-24T07:30:59.335Z","repository":{"id":361987003,"uuid":"1256422674","full_name":"mlang/caret","owner":"mlang","description":"Streaming pager which uses the terminal cursor as reading position","archived":false,"fork":false,"pushed_at":"2026-07-14T06:49:12.000Z","size":94075,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-14T08:26:14.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-01T19:06:07.000Z","updated_at":"2026-07-14T06:49:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mlang/caret","commit_stats":null,"previous_names":["mlang/caret"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mlang/caret","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlang%2Fcaret","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlang%2Fcaret/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlang%2Fcaret/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlang%2Fcaret/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlang","download_url":"https://codeload.github.com/mlang/caret/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlang%2Fcaret/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35832970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-24T02:00:07.870Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-24T07:30:59.261Z","updated_at":"2026-07-24T07:30:59.321Z","avatar_url":"https://github.com/mlang.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# caret\n\n`caret` is a cursor-based syntax-aware streaming terminal pager\nwith keyboard-driven navigation, search, selection and copy.\n`tmux` users can think of it as streaming copy-mode.\nYou can move through output while it arrives, and use the terminal\ncursor to set a mark and copy the selection.\n\n## Build\n\nRequirements:\n\n- POSIX-like system\n- C++23 compiler\n- `ncursesw`\n\nInstall:\n\n```sh\ncmake -DCMAKE_INSTALL_PREFIX=$HOME/.local .\nmake install\n```\n\n## Usage\n\nWith streaming input:\n\n```sh\nllm ... | caret\n```\n\nWith files:\n\n```sh\ncaret file.txt another-file.txt\n```\n\nWith syntax-aware commands:\n\n```sh\ncaret --language cpp file.cc\n```\n\nLanguage options apply to the files that follow them, until the next language\noption:\n\n```sh\ncaret -l c foo.def -l markdown README\n```\n\nList available languages:\n\n```sh\ncaret -L\n```\n\n`caret` reads data from standard input or files, but takes keyboard input from\n`/dev/tty`, so pipelines remain interactive.\n\nFor file input, caret enables syntax-aware commands automatically when it\nrecognizes the filename or extension. Use `--language LANG` or `-l LANG` to\noverride automatic detection for the following files. Input from stdin defaults\nto Markdown.\nRun `caret -L` to print the complete language list.\n\n## Keys\n\nMovement:\n\n- `Up` / `Down`, `k` / `j`: move by one wrapped screen row\n- `Left` / `Right`, `h` / `l`: move horizontally, crossing row boundaries\n- `M-b` / `M-f`: move to the previous/next word, crossing logical lines\n- `C-M-b` / `C-M-f`: move to the previous/next matching bracket\n- `%`: move to the matching bracket, or the next bracket on the current line\n- `C-a` / `C-e`, `Home` / `end`, `0` / `$`: beginning/end of current logical line\n- `^` / `M-m`: move to the first non-whitespace character of the current logical line\n- `PageUp` / `PageDown`, `Ctrl-B` / `Ctrl-F`: move by nearly one screen\n- `zt` / `zz` / `zb`: place the cursor row at the top/middle/bottom of the viewport\n- `Ctrl-L`: recenter the viewport on the cursor (equivalent to `zz`)\n- `M-\u003c` / `M-\u003e`, `g g` / `G`: start/end of document\n- `:N`: move to the start of logical line `N` (1-based, clamped to the document)\n- `:n` / `:p`: switch to the next/previous file\n- `Space`: page down\n\nSelection and copy:\n\n- `C-Space`: set mark at cursor\n- `x`: exchange cursor and mark\n- `M-w`: copy region between mark and cursor\n- `C-k`: copy from cursor to end of current logical line\n\nSyntax selection, when `--language` / `-l` is set:\n\n- `Enter`: select syntax node at cursor\n- `u` / `p`: previous/next sibling syntax range\n- `i` / `o`: shrink/expand syntax selection\n\nSearch:\n\n- `C-s` / `C-r`: incremental literal search forward/backward\n- `/` / `?`: forward/backward regex search\n- `*` / `#`: search forward/backward for the keyword at or after the cursor\n- `n` / `N`: repeat last search in the same/opposite direction\n- `f` / `F` then character: next/previous matching character in current line\n\nQuit:\n\n- `q`, `Q`, `C-c`, `C-d`\n\n## Prompts\n\nThe `/`, `?`, and `:` prompts share these editing keys:\n\n- `Left` / `Right`, `Ctrl-B` / `Ctrl-F`: move the prompt cursor\n- `Home` / `End`, `Ctrl-A` / `Ctrl-E`: move to the start/end of the prompt\n- `Backspace`: delete before the cursor, or close an empty prompt\n- `Delete`: delete the character under the cursor\n- `C-u`: delete from the cursor to the start of the prompt\n- `C-k`: delete from the cursor to the end of the prompt\n- `Esc`, `Ctrl-G`: cancel\n\nIn the `:` prompt, a number moves to the start of that logical line. Line\nnumbers are 1-based and clamp to the first or last line. `:n` and `:p` switch\nbetween files without wrapping. Empty input does nothing; other input reports\n`Unknown command`. `Up` / `Down` browse its session-local command history, which\nincludes every non-empty submitted command and is separate from search history.\n\n## Regex search\n\nSearches are line-local and use ECMAScript regex syntax.\n\nIn the search prompt:\n\n- `Enter`: submit search\n- `Up` / `Down`: browse session-local search history\n\nNon-empty submitted searches and keyword searches are saved in history. `/`,\n`?`, `*`, and `#` share the same history.\n\nWhen a match is found, the cursor moves to the start of the match and the mark\nis set to the end, highlighting the match. `M-w` then copies the match.\n\n## Incremental search\n\nIncremental searches are line-local literal searches. The search string is shown\nin the status line while matches are found as you type. `Ctrl-S` repeats forward\nand `Ctrl-R` repeats backward. `Backspace` edits the search string.\n\n`C-g` cancels incremental search and restores the cursor and mark. Movement\nand other non-text command keys end incremental search at the current match,\nthen run normally.\n\n## Copy output\n\nThe last region copied with `M-w` is printed to standard output after `caret`\nleaves the alternate screen.\n\nInside tmux, `M-w` also sends the region to:\n\n```sh\ntmux load-buffer -\n```\n\nIf `brltty-clip` is found, the region is also sent to it.\n\n## Notes\n\n- Regular files are loaded directly as UTF-8. Streaming input from stdin and\n  FIFOs is decoded using the current locale’s multibyte encoding; all active\n  streams are polled concurrently.\n- The program links against `ncursesw`.\n- ANSI CSI and OSC escape sequences in the input stream are ignored.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlang%2Fcaret","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlang%2Fcaret","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlang%2Fcaret/lists"}