{"id":13437233,"url":"https://github.com/klange/bim","last_synced_at":"2025-03-19T06:30:53.491Z","repository":{"id":41501017,"uuid":"146534424","full_name":"klange/bim","owner":"klange","description":"Extensible, lightweight terminal text editor with syntax highlighting and plugin support.","archived":true,"fork":false,"pushed_at":"2023-12-28T05:49:30.000Z","size":2279,"stargazers_count":282,"open_issues_count":6,"forks_count":17,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-27T21:50:23.811Z","etag":null,"topics":["c","code-editor","editor","linux","modal-editing","syntax-highlighting","terminal-based","text-editor","toaruos","vi-clone"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/klange.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["klange"]}},"created_at":"2018-08-29T02:34:21.000Z","updated_at":"2024-09-28T16:07:27.000Z","dependencies_parsed_at":"2023-01-19T19:45:56.597Z","dependency_job_id":"29f476a2-be44-4cea-a656-630e7d748556","html_url":"https://github.com/klange/bim","commit_stats":null,"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klange%2Fbim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klange%2Fbim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klange%2Fbim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klange%2Fbim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klange","download_url":"https://codeload.github.com/klange/bim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244370911,"owners_count":20442315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","code-editor","editor","linux","modal-editing","syntax-highlighting","terminal-based","text-editor","toaruos","vi-clone"],"created_at":"2024-07-31T03:00:55.238Z","updated_at":"2025-03-19T06:30:50.992Z","avatar_url":"https://github.com/klange.png","language":"C","readme":"# Bim - A Text Editor\n\n![screenshot](docs/screenshot.png)\n\nBim is a terminal text editor with syntax highlighting.\n\nInspired by Vim (one might say a Bad Imitation) and featuring similar mode-based editing, Bim was originally written for ToaruOS, but it has also been tested in Linux, Sortix, FreeBSD, and macOS.\n\n## Goals / Purpose\n\nBim is intended as the included text editor in ToaruOS, a hobby operating system built from scratch.\n\nBim aims to be lightweight and featureful with no external* dependencies, providing a modern editing experience in a lightweight, extensible package.\n\n## Features\n\n- Vim-like modal interactions.\n- Arrow-key and traditional vi `hjkl` navigation.\n- Syntax highlighting (currently for C/C++, Python, Makefiles, Java, Rust, and a few others).\n- Integrated scripting environment with [Kuroko](https://github.com/kuroko-lang/kuroko).\n- Themes, including 256-color and 24-bit color support.\n- Indentation adjustment and naïve automatic indentation.\n- Multiple editor tabs.\n- Basic Unicode support (sufficient for things like Japanese, but not capable of more complex scripts).\n- Efficient screen redrawing.\n- Terminal support tested in ToaruOS, Sortix, xterm, urxvt, Gnome, XFCE, Linux and FreeBSD consoles, macOS Terminal.app, iTerm2.\n- Mouse support in Xterm-like terminals.\n- Line and character selection, with yanking (paste buffer).\n- Incremental forward and backward search with match highlighting, smart case sensitivity, some regex support.\n- Undo/redo stack.\n- Highlight matching parens/braces.\n- Multi-line insert mode.\n- Persistent cursor location between sessions.\n- Git integration, shows `git diff` status in-line, along with unsaved changes.\n- Convert syntax highlighted code to an HTML document.\n- Split viewports to view multiple files or different parts of the same file.\n- Simple autocompletions using ctags.\n\n## Build Requirements\n\nBim requires a sufficiently Unix-like C library and a C99 compiler with certain GNU extensions (such as `__attribute__((constructor))`).\n\nBim 3 also needs [Kuroko](https://github.com/kuroko-lang/kuroko), which has has similar requirements. Bim is typically statically linked with the Kuroko interpreter for Linux builds, and dynamically linked for ToaruOS builds.\n\nBim has been built successfully for a number of targets, including various BSDs, ToaruOS, Sortix, and others.\n\n### Installation\n\nFirst, install Kuroko:\n\n```bash\ngit clone https://github.com/kuroko-lang/kuroko\ncd kuroko\nmake \u0026\u0026 sudo make install # You can obtain deb packages, or build one with 'fpm' with 'make deb'\n```\n\nThen build Bim:\n\n```bash\ngit clone https://github.com/klange/bim\ncd bim\nmake \u0026\u0026 sudo make install\n```\n\nThen install the example config:\n\n```bash\ncp docs/example.bim3rc ~/.bim3rc\n```\n\n### Terminal Support\n\nBim has been tested in a number of terminals, and while it does not use `terminfo` databases, basic functionality should be available in the vast majority of remnant emulators and even classic DEC hardware.\n\nIf the terminal you are using has some quirks or does not play well with the default assumptions, you can modify the behavior to suit your environment.\n\nCapability features can be controlled with \"quirks\", either through the `quirk` command in a bimrc, or with the `-O` command line option.\n\nThe format of the `quirk` command is `quirk(envvar,teststr,'no...','can...',...)` where `ENVVAR` is the name of an environment variable and `teststr` is a string to check against which must be a prefix of the environment variable.\n\nFor example, `quirk('TERM','xterm','nounicode')` will disable Unicode output on all terminals starting with \"xterm\" (including \"xterm-256color\").\n\nYou may also specifies quirks with the `$COLORTERM` environment variable, or the `$TERMINAL_EMULATOR` variable set by certain IDEs.\n\nSome example quirk configurations are provided in [docs/example.bim3rc](docs/example.bim3rc) and may be a good place to start if you are experiencing rendering issues.\n\nUnicode/UTF-8 support is recommended and assumed by default. The `nounicode` quirk option will disable output of UTF-8 characters and render them as codepoint hints like `\u003cU+1234\u003e` instead.\n\n256-color and 24-bit color are also assumed by default, disable them with the `no256color` and `no24bit` quirks respectively.\n\nIf you have a particularly low-color terminal, the `nobright` quirk will hint to themes that only the lower 8 colors should be used.\n\nThree scroll modes are supported: shift scrolling, insert/delete scrolling, and redraw scrolling.\n\nShift scrolling (`^[[1S`/`^[[1T`) is assumed by default. If your terminal supports insert/delete scrolling (`^[[L`/`^[[M`), enable the `caninsert` quirk.\n\nIf neither scrolling option is available, use the `noscroll` quirk to redraw the text field when scrolling. This will probably be slow!\n\nMouse support with `^[[?1000h` is assumed by default. Use the `nomouse` quirk to disable it.\n\nIf your terminal supports SGR mouse modes (\"1006\"), enable the `cansgrmouse` quirk. Most xterm-like terminals support this and it will provide support for click on cells in larger terminal windows.\n\nAlternate screen support is also assumed. This is normally fine even if your terminal doesn't support it, but if it causes issues the `noaltscreen` quirk will disable it.\n\n## Key Bindings\n\nDefault keybindings can be found in [docs/mappings.md](docs/mappings.md).\n\nThis listing can be generated with `bim --dump-mappings`.\n\n## Commands\n\nA complete listing of available commands can be found in [docs/commands.md](docs/commands.md).\n\nThis listing can be generated with `bim --dump-commands`.\n\n## Additional Bim Functionality\n\nYou can use Bim to display files in your terminal with syntax highlighting with `bim -c` (no line numbers) and `bim -C` (with line numbers).\n\n![screenshot](docs/screenshot_cat.png)\n\nYou can pipe text to bim for editing with `bim -`. Note that Bim will wait for end-of-file before launching, so this is not suitable for use as a pager (pager support is planned).\n\nBim can also be used to generate HTML documents with syntax-highlighted source code with `bim --html`; the configured theme will be used.\n\n## Themes\n\nBim includes a handful of color schemes for the interface and syntax highlighting.\n\n### ANSI\n\nA plain 16-color theme. Can be configured for use on terminals with or without bright color support. Looks a bit like Irssi.\n\n![ansi](docs/theme_ansi.png)\n\n### Sunsmoke\n\nAn original 24-bit color theme with rustic browns and subdued pastel colors.\n\n![sunsmoke](docs/screenshot.png)\n\n### Sunsmoke-256\n\nA 256-color version of Sunsmoke for use in terminals that do not support 24-bit color.\n\n![sunsmoke256](docs/theme_sunsmoke256.png)\n\n### Wombat\n\nA 256-color theme based on the theme of the same name for Vim.\n\n![wombat](docs/theme_wombat.png)\n\n### Solarized Dark\n\nA 24-bit color theme based on the popular color palette.\n\n![solarized-dark](docs/theme_solarized_dark.png)\n\n### City Lights\n\nA 24-bit color theme based on the one for Atom and Sublime, featuring low contrast blues.\n\n![citylights](docs/theme_citylights.png)\n\n### Light\n\nBased on selenized by Jan Warchoł\n\n![light](docs/theme_light.png)\n\n## Config File\n\nBim will automatically import `~/.bim3rc` on startup.\n\nA detailed bimrc example is available at [docs/example.bim3rc](docs/example.bim3rc).\n\nBim scripts are written in [Kuroko](https://github.com/kuroko-lang/kuroko).\n\n## Syntax Support\n\nNot all syntax highlighters are complete or support all features of their respective languages.\n\n- C/C++\n- Python\n- Java\n- diffs\n- Generic INI-style config files\n- Rust\n- git commits and interactive rebase\n- Make / GNU Make\n- Markdown (with some inline code highlighting support)\n- JSON\n- XML / HTML\n- Protobuf\n- Bash\n\n## Code Structure\n\nBim's core functionality lives in `bim.c`.\n\nSyntax highlighters and themes are written in Kuroko and found in the `syntax` and `themes` directories.\n\n## Regex Syntax\n\nBim's regular expression engine is something I cooked up haphazardly. Its functionality is somewhat limited and behavior is subject to change.\n\n- Search matching is on a single line. Multi-line matching is not implemented.\n- Some characters with special meaning can be escaped with `\\`.\n- `^` matches the start of a line, `$` matches the end.\n- `.` matches any character.\n- `[]` brackets can be used for alternative matches.\n  - `^` as the first character negates the match.\n  - Use `a-b` for simple ranges.\n  - To include `-` in a bracket expression, place it before any other character but after a negating `^`, such as `[-_*]`.\n  - To include `^` in a bracket expression, use it any position after the first. `[^^]` means \"anything except `^`\".\n  - To include `]` in a bracket expression, use `\\]`.\n  - Tab characters may be represented as `\\t`. Use `\\\\` for a literal backslash.\n- `.`, `[]`, and single characters may be combined with the following, with backtracking:\n  - `?` optionally matches once.\n  - `*` matches any number of occurances.\n  - `+` matches at least on occurance.\n  - `*` and `+` are greedy by default, but can be followed with `?` to make them non-greedy.\n- `()` parentheses can be used at the top level for capture groups.\n  - Up to 9 capture groups will capture for replacements.\n  - Parentheses may be nested, but nested groups currently do not capture.\n  - Capture groups can not be combined with repetition operators (but repetition operators can be used within them).\n\nWhen performing replacements, some escape sequences are supported:\n\n- `\\t` inserts a tab character. `\\\\` inserts a literal backslash.\n- `\\0` inserts the entire matched string.\n- `\\1` through `\\9` insert captured groups.\n\n## Bim is not Vim\n\nSome interactions in Bim work differently from Vim, and sometimes this is intentional.\nBim's primary interactions are built around a selection, while Vim has verbs and navigation nouns.\n`CHAR SELECTION` does not let the cursor move past the end of the line, unlike `VISUAL` mode in Vim.\n\n## Bim wants to be more like Vim\n\nSome interactions in Bim work differently from Vim, and sometimes this is unintentional.\nBim is missing many features I would like to implement, like regular expression search (and replacement).\n\n## License\n\nBim is released under the terms of the ISC license, which is a simple BSD-style license. See [LICENSE](LICENSE) for details.\n\n## Development\n\nBim is still primarily developed alongside ToaruOS. This repository is a mirror with fake history going back to the start of that project. Pull requests merged here will be patched into [ToaruOS](https://git.toaruos.org/klange/toaruos).\n\n## Community\n\nIf you're using Bim, want to contribute to development, or have ideas for new features, join us in `#bim` on Libera.\n","funding_links":["https://github.com/sponsors/klange"],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklange%2Fbim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklange%2Fbim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklange%2Fbim/lists"}