A text editor in ≤1024 lines of code, written in Rust
A configurable text editor with UTF-8 support, incremental search, syntax highlighting, line numbers and more, written in less than 1024 lines[^1] of Rust with minimal dependencies.
[^1]: Counted per platform, excluding tests and Clippy directives, see count_loc
Kibi is compatible with Linux, macOS, Windows 10[^2], and WASI.
[^2]: Kibi requires the terminal to support ANSI escape sequences. Windows 10 version 1703 (Creators Update, April 2017) and above are supported.
This project is inspired by kilo, a text
editor written in C.
See comparison below for a list of additional features.
Contributions are welcome! Be careful to stay below the 1024-line limit...
cargoYou can install Kibi with cargo:
cargo install kibiSyntax highlighting configuration files are available in the
syntax.d directory of this repository. They need to be placed in
one of the configuration directories mentioned in the
Configuration/Syntax Highlighting section.
For instance:
cd ~/repos
git clone https://github.com/ilai-deutel/kibi.git
mkdir -p ~/.local/share/kibi/
ln -sr ./kibi/syntax.d ~/.local/share/kibi/syntax.d3 packages are available on the AUR:
kibi and
kibi-bin.
kibi-git.
kibiInstallation with an AUR helper, for instance using paru:
paru -Syu kibiInstall manually with makepkg:
git clone https://aur.archlinux.org/kibi.git
cd kibi
makepkg -sikibi-binInstallation with an AUR helper, for instance using paru:
paru -Syu --pgpfetch kibi-binInstall manually with makepkg:
gpg --keyserver keys.openpgp.org --recv-keys 102588418FF7E165696490A206E8A973494808A2
git clone https://aur.archlinux.org/kibi-bin.git
cd kibi-bin
makepkg -sikibi-gitInstallation with an AUR helper, for instance using paru:
paru -Syu kibi-gitInstall manually with makepkg:
git clone https://aur.archlinux.org/kibi-git.git
cd kibi-git
makepkg -siKibi is available as a Termux package.
Installation instructionsThe package is available in COPR as atim/kibi.
sudo dnf copr enable atim/kibi -y
sudo dnf install kibiKibi is available from the official repos.
Installation instructionsInstall using:
pkgin install kibior build from source:
cd /usr/pkgsrc/editors/kibi
make installKibi is available on Flathub.
Command line instructions The flatpak can be installed using:flatpak install flathub com.github.ilai_deutel.kibiYou can then run Kibi with:
flatpak run com.github.ilai_deutel.kibikibi # Start an new text buffer
kibi <file path> # Open a file
kibi --version # Print version information and exit| Keyboard shortcut | Description |
|---|---|
| Ctrl + F | Incremental search; use arrows to navigate |
| Ctrl + S | Save the buffer to the current file, or specify the file path |
| Ctrl + G | Go to <line number>[:<column number>] position |
| Ctrl + Q | Quit |
| Ctrl + D | Duplicate the current row |
| Ctrl + E | Execute an external command and paste its output |
| Ctrl + R | Remove an entire line |
| Ctrl + C | Copies the entire line |
| Ctrl + X | Cuts the entire line |
| Ctrl + V | Will paste the copied line |
| Ctrl + ← | Moves cursor to previous word |
| Ctrl + → | Moves cursor to next word |
| Ctrl + / | Comment or uncomment the current line |
Kibi can be configured using a configuration file. It must follow this format:
# The size of a tab. Must be > 0.
tab_stop=4
# The number of confirmations needed before quitting, when changes have been
# made since the file was last changed.
quit_times=2
# The duration for which messages are shown in the status bar, in seconds.
message_duration=3
# Whether to show line numbers.
show_line_numbers=trueThe location of these files is described below.
kibi follows the XDG Base Directory Specification:
$XDG_CONFIG_HOME/kibi/config.ini if environment variable $XDG_CONFIG_HOME
is defined, ~/.config/kibi/config.ini otherwise.$XDG_CONFIG_DIRS/kibi/config.ini if environment variable
$XDG_CONFIG_DIRS is defined, /etc/kibi/config.ini or
/etc/xdg/kibi/config.ini otherwise.A configuration file can be located at %APPDATA%\Kibi\config.ini.
Syntax highlighting can be configured using INI files which follow this format:
…The location of these files is described below.
kibi follows the XDG Base Directory Specification:
$XDG_DATA_HOME/kibi/syntax.d/<file_name>.ini
if environment variable $XDG_DATA_HOME is defined,
~/.local/share/kibi/syntax.d/<file_name>.ini otherwise.$XDG_DATA_DIRS/kibi/syntax.d/<file_name>.ini
if environment variable $XDG_DATA_DIRS is defined,
/usr/local/share/kibi/syntax.d/<file_name>.ini or
/usr/share/kibi/syntax.d/<file_name>.ini otherwise.Syntax highlighting configuration files can be located at %APPDATA%\Kibi\syntax.d\<file_name>.ini.
kiloThis project is inspired by kilo, a text
editor written by Salvatore Sanfilippo (antirez) in C, and
this tutorial (also in C).
kibi provides additional features:
-- (following POSIX.1-2024 12. Utility
Conventions)sudoers file via visudoContributions of any kind are welcome! Make sure to check out the contributing guide:
CONTRIBUTING.md.
This project must remain tiny, so using advanced dependencies such as ncurses,
toml or
ansi-escapes would be cheating.
The following dependencies provide wrappers around system calls.
libcwinapiwinapi-utilIn addition, unicode-width is used to determine the displayed width of Unicode
characters. Unfortunately, there is no way around it: the
unicode character width table
is 230 lines long.
kilo source code from C to Rust and trying to make it idiomatic
was interestingThis project follows the all-contributors specification (emoji key). Contributions of any kind welcome!
Ilaï Deutel |
Vishal Anan |
No open issues yet, or sync has not completed.