Extensible, lightweight terminal text editor with syntax highlighting and plugin support.
Bim is a terminal text editor with syntax highlighting.
Inspired 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.
Bim is intended as the included text editor in ToaruOS, a hobby operating system built from scratch.
Bim aims to be lightweight and featureful with no external dependencies, providing a modern editing experience in a lightweight, extensible package.
NOTE: This branch currently represents a preview of an in-progress rewrite of Bim currently dubbed "Bim 3", which is being rebuilt from the ground up around Kuroko to provide a fully integrated environment for writing plugins and extensions.
git diffstatus in-line, along with unsaved changes.
Bim requires a sufficiently Unix-like C library and a C99 compiler with certain GNU extensions (such as
Additionally, in this and future versions, a system installation of Kuroko is needed.
Bim has been built successfully for a number of targets, including various BSDs, ToaruOS, Sortix, and others.
Bim has been tested in a number of terminals, and while it does not use
terminfodatabases, basic functionality should be available in the vast majority of remnant emulators and even classic DEC hardware.
If 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.
Capability features can be controlled with "quirks", either through the
quirkcommand in a bimrc, or with the
-Ocommand line option.
The format of the
ENVVARis the name of an environment variable and
teststris a string to check against which must be a prefix of the environment variable.
quirk('TERM','xterm','nounicode')will disable Unicode output on all terminals starting with "xterm" (including "xterm-256color").
You may also specifies quirks with the
$COLORTERMenvironment variable, or the
$TERMINAL_EMULATORvariable set by certain IDEs.
Some example quirk configurations are provided in docs/example.bim3rc and may be a good place to start if you are experiencing rendering issues.
Unicode/UTF-8 support is recommended and assumed by default. The
nounicodequirk option will disable output of UTF-8 characters and render them as codepoint hints like
256-color and 24-bit color are also assumed by default, disable them with the
If you have a particularly low-color terminal, the
nobrightquirk will hint to themes that only the lower 8 colors should be used.
Three scroll modes are supported: shift scrolling, insert/delete scrolling, and redraw scrolling.
Shift scrolling (
^[[1T) is assumed by default. If your terminal supports insert/delete scrolling (
^[[M), enable the
If neither scrolling option is available, use the
noscrollquirk to redraw the text field when scrolling. This will probably be slow!
Mouse support with
^[[?1000his assumed by default. Use the
nomousequirk to disable it.
If your terminal supports SGR mouse modes ("1006"), enable the
cansgrmousequirk. Most xterm-like terminals support this and it will provide support for click on cells in larger terminal windows.
Alternate screen support is also assumed. This is normally fine even if your terminal doesn't support it, but if it causes issues the
noaltscreenquirk will disable it.
Default keybindings can be found in docs/mappings.md.
This listing can be generated with
A complete listing of available commands can be found in docs/commands.md.
This listing can be generated with
You can use Bim to display files in your terminal with syntax highlighting with
bim -c(no line numbers) and
bim -C(with line numbers).
You 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).
Bim can also be used to generate HTML documents with syntax-highlighted source code with
bim --html; the configured theme will be used.
Bim includes a handful of color schemes for the interface and syntax highlighting.
A plain 16-color theme. Can be configured for use on terminals with or without bright color support. Looks a bit like Irssi.
An original 24-bit color theme with rustic browns and subdued pastel colors.
A 256-color version of Sunsmoke for use in terminals that do not support 24-bit color.
A 256-color theme based on the theme of the same name for Vim.
A 24-bit color theme based on the popular color palette.
A 24-bit color theme based on the one for Atom and Sublime, featuring low contrast blues.
Based on selenized by Jan Warchoł
Bim will automatically run commands from
A detailed bimrc example is available at docs/example.bim3rc.
Bim scripts are written in Kuroko.
Not all syntax highlighters are complete or support all features of their respective languages.
Bim's core functionality lives in
Syntax highlighters and themes are written in Kuroko and found in the
Some interactions in Bim work differently from Vim, and sometimes this is intentional. Bim's primary interactions are built around a selection, while Vim has verbs and navigation nouns.
CHAR SELECTIONdoes not let the cursor move past the end of the line, unlike
VISUALmode in Vim.
Some interactions in Bim work differently from Vim, and sometimes this is unintentional. Bim is missing many features I would like to implement, like regular expression search (and replacement).
Bim is released under the terms of the ISC license, which is a simple BSD-style license. See LICENSE for details.
Bim 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.
If you're using Bim, want to contribute to development, or have ideas for new features, join us in