{"id":30791897,"url":"https://github.com/sidojain/cypher","last_synced_at":"2026-04-13T09:32:01.384Z","repository":{"id":309382536,"uuid":"1035466068","full_name":"SidoJain/Cypher","owner":"SidoJain","description":"Cypher is a lightweight, feature rich, terminal-based text editor written in C, using Tree-Sitter highlighting.","archived":false,"fork":false,"pushed_at":"2026-03-29T13:44:53.000Z","size":873,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-29T16:43:18.797Z","etag":null,"topics":["c","data-structures","file-io","linux","low-level-programming","piece-table","raw-mode","terminal","text-editor","tree-sitter","undo-redo","wsl2"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SidoJain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-08-10T13:13:13.000Z","updated_at":"2026-03-29T13:44:56.000Z","dependencies_parsed_at":"2026-03-11T16:03:31.211Z","dependency_job_id":null,"html_url":"https://github.com/SidoJain/Cypher","commit_stats":null,"previous_names":["sidojain/cypher"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SidoJain/Cypher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SidoJain%2FCypher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SidoJain%2FCypher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SidoJain%2FCypher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SidoJain%2FCypher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SidoJain","download_url":"https://codeload.github.com/SidoJain/Cypher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SidoJain%2FCypher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["c","data-structures","file-io","linux","low-level-programming","piece-table","raw-mode","terminal","text-editor","tree-sitter","undo-redo","wsl2"],"created_at":"2025-09-05T15:08:11.678Z","updated_at":"2026-04-13T09:32:01.378Z","avatar_url":"https://github.com/SidoJain.png","language":"C","readme":"# Cypher - Terminal Text Editor\n\nCypher is a lightweight terminal-based text editor written in C, featuring native `Tree-Sitter` semantic syntax highlighting.\nIt runs in the terminal in **raw mode**.  \nThis README file has been completely written using Cypher.  \n\n## Features\n\n- **File Editing**\n  - Open and edit text files directly from the terminal.\n  - Save changed (`Ctrl-S`) with overwrite support.\n\n- **Undo and Redo Engine**\n  - Time-based Batching: Groups continuous typing or backspacing into a single undo action.\n  - Macro Transactions: Massive operations (like pasting a huge block or a 50-item \"Replace All\") are grouped and undone in a single keystroke.\n  - Save State Tracking: Undoing your way back to the last saved state accurately removes the (modified) flag.\n\n- **Navigation**\n  - `Arrow keys` for cursor movement.\n  - `Home/End` keys to jump to start/end of a line.\n  - `Page Up/Page Down` for fast scrolling.\n  - `Ctrl-ArrowKeys` for fast navigation.\n  - `Ctrl-G` to jump to a specific line.\n\n- **Mouse Support**\n  - Mouse Scroll Wheel to scroll viewport up / down.\n  - Mouse left click to jump to row and column.\n  - Dragging while mouse left click to select text.\n\n- **Editing Operations**\n  - Insert text anywhere.\n  - Backspace / Delete characters.\n  - Insert new lines (`Enter`).\n  - Automatic tab expansion to spaces.\n  - Paste command (`Ctrl-V`) from clipboard.\n  - Copy (`Ctrl-C`) and Cut (`Ctrl-X`) commands to clipboard.\n  - Move whole rows up (`Alt-Up`) or down (`Alt-Down`).\n  - Smart Bracket Assist: Auto-closes brackets/quotes.\n  - Smart Indentation: Pressing Enter between brackets automatically indents the new line and pushes the closing bracket down.\n  - Bracket Matching: Highlights the corresponding open/close bracket when your cursor is over one.\n  - Row Manipulation: Move rows up/down (`Alt-Up/Down`) or duplicate them (`Shift-Alt-Up/Down`).\n\n- **Search \u0026 Replace**\n  - Incremental search (`Ctrl-F`) with real time navigation between matches.\n  - Works with pre-selected text well.\n  - Replace (`Ctrl-R`) functionality with interactive mode as well as replace all mode.\n\n- **Status \u0026 Message Bars**\n  - Displays filename, total lines and cursor line.\n  - Temporary message area for prompts, warnings, information.\n\n- **Syntax Highlighting (Tree-sitter)**\n  - Semantic Parsing: Uses Abstract Syntax Trees (ASTs) instead of brittle regular expressions for flawless, context-aware code highlighting.\n  - Dynamic Language Loading: Automatically loads language parsers at runtime via `.so` shared libraries. Adding a new language (C, Python, Rust, Go, etc.) requires zero recompilation of the core editor.\n  - True Color (24-bit) Rendering: Renders rich, high-fidelity RGB colors directly in your terminal.\n  - Hot-Swappable Themes: Fully customizable styling via a simple theme.config file. Map specific AST nodes directly to hex codes to recreate themes like VS Code Dark+ (default).\n\n## Keyboard Shortcuts\n\n| Shortcut                              | Action                            |\n|---------------------------------------|-----------------------------------|\n| `Ctrl-Q`                              | Quit editor                       |\n| `Ctrl-S`                              | Save current file                 |\n| `Ctrl-F`                              | Search in file                    |\n| `Ctrl-R`                              | Find and replace                  |\n| `Ctrl-A`                              | Select all                        |\n| `Ctrl-H`                              | Open keybinds manual              |\n| `Ctrl-C`                              | Copy selected text                |\n| `Ctrl-X`                              | Cut selected text                 |\n| `Ctrl-V`                              | Paste from clipboard              |\n| `Ctrl-G / L`                          | Jump to line                      |\n| `Ctrl-Z`                              | Undo last major change            |\n| `Ctrl-Y`                              | Redo last major change            |\n| `Ctrl-D`                              | Debug Tree-Sitter Capture         |\n| `Arrow Keys`                          | Move cursor                       |\n| `Home / End`                          | Move to start / end of line       |\n| `Page Up`                             | Scroll up by one screen           |\n| `Page Down`                           | Scroll down by one screen         |\n| `Backspace`                           | Delete character left of cursor   |\n| `Delete`                              | Delete character under cursor     |\n| `Enter`                               | Insert new line                   |\n| `Shift-ArrowKeys / Home / End`        | Select text                       |\n| `Ctrl-Left / Right`                   | Skip words                        |\n| `Ctrl-Up / Down`                      | Scroll up / down                  |\n| `Alt-Up / Down`                       | Move row up / down                |\n| `Shift-Alt-Up / Down`                 | Copy row up / down                |\n\n## Clipboard Support\n\nCypher features integrated system clipboard handling that works across local and remote sessions. It employs a dual strategy approach to ensure compatibility across different operating systems and connection types.\n\n### How it Works\n\n1. **MacOS (Local):** When running natively on MacOS, Cypher detects the environment and uses the `pbcopy` utility to communicate directly with the system clipboard.\n\n2. **Linux \u0026 Remote (SSH):** For Linux users or those connected via SSH, Cypher utilizes the **OSC 52** terminal escape sequence. This method Base64-encodes the selected text and \"tunnels\" it through the terminal emulator to your local machine's clipboard.\n\n### Setup \u0026 Requirements\n\nTo use the clipboard over SSH or on Linux, your terminal emulator must support the OSC 52 protocol.\n\n#### 1. Terminal Compatibility\n\n| Terminal | Compatibility | Action Required |\n| :--- | :--- | :--- |\n| **iTerm2** | Excellent | Enable \"Applications in terminal may access clipboard\" in **Settings \u003e General \u003e Applications**. |\n| **Alacritty / Kitty** | Native | Supported by default in most versions. |\n| **Windows Terminal** | Good | Supported since version 1.17. |\n| **VS Code Terminal** | Native | Works out of the box. |\n| **Apple Terminal** | **None** | Does not support OSC 52. Consider using [iTerm2](https://iterm2.com/) for remote clipboard support. |\n\n#### 2. Using with tmux\n\nIf you use `tmux`, you must configure it to allow clipboard and mouse operations. Add the following line to your `~/.tmux.conf`:\n\n```bash\nset -s set-clipboard on\nset -g mouse on\nset -s escape-time 0\n```\n\n### Known Limitations\n\n- Size Constraints: Most terminal emulators limit OSC 52 transfers to approximately 74 KB. Large copy operations exceeding this limit may fail silently.\n- Security Settings: Some Linux distributions or hardened terminal configurations disable clipboard writing by default to prevent malicious scripts from altering your clipboard.\n\n## Tree Sitter Setup\n\nTo utilize Cypher's semantic syntax highlighting, ensure the following files are present in the directory where Cypher is executed:\n\n1. `theme.config`: A plain text file defining the hexadecimal colors for Tree-Sitter nodes.\n2. `parsers/` A folder containing the compiled Tree-Sitter `.so` shared libraries for the languages you want to edit (e.g., `parsers/tree-sitter-c.so`).\n3. `queries/` Directory: A folder containing the Tree-Sitter query files (`highlights.scm`) for each language. These files map the structural code parsed by the `.so` files to the color tags defined in your `theme.config`. They must be placed in a subdirectory matching the language name (e.g., `queries/c/highlights.scm`).\n\nIf these files are not present, Cypher will safely fall back to plain text editing.\n\n### Current file formats that work with Tree-Sitter\n\n- C\n- C++\n- Python\n\n## Installation \u0026 Compilation\n\n- **Requirements:**\n  - GCC compiler.\n  - Make utility\n  - POSIX-compliant system (Linux, macOS, WSL).\n\n- **Compile:**\n\n```bash\nmake\n```\n\n- **Run:**\n\n```bash\n# for new file\nmake run\n\n# for existing file\nmake run FILE={filename}\n```\n\n- **Clean:**\n\n```bash\nmake clean\n```\n\n## Usage\n\n- Clone this repo.\n\n```bash\ngit clone --recursive https://github.com/SidoJain/Cypher.git\ncd Cypher\n```\n\n- Make the executable file.\n\n```bash\nmake\n```\n\n- In ~/.bashrc\n\n```bash\n# add executable file directory to PATH\nexport PATH=\"\u003cdirectory_path\u003e:$PATH\"\n```\n\n- Use cypher to view/edit any file.\n\n```bash\ncypher file.txt\n```\n\n## License\n\nThis project is licensed under the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidojain%2Fcypher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidojain%2Fcypher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidojain%2Fcypher/lists"}