Skip to content
A text editor in ≤1024 lines of code, written in Rust
Rust Shell Batchfile
Branch: master
Clone or download

Kibi: A text editor in ≤1024 lines of code, written in Rust

Build Status Crate AUR Minimum rustc version Platform License


A configurable text editor with UTF-8 support, incremental search, syntax highlighting, line numbers and more, written in less than 1024 lines1 of Rust with minimal dependencies.

Kibi is compatible with Linux, macOS, and Windows 10 (beta).

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...

1.: Counted with tokei


With cargo

You can install Kibi with cargo:

$ cargo install kibi

Syntax highlighting configuration files are available in the config_example/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
$ mkdir -p ~/.config/kibi
$ ln -sr ./kibi/syntax ~/.config/kibi/syntax.d

Arch User Repository (Arch Linux)

kibi is available on the AUR.

Installation with an AUR helper

For instance, using yay:

yay -Syu kibi

Manual installation with makepkg

git clone
cd kibi
makepkg -si


kibi              # Start an new text buffer
kibi <file path>  # Open a file
kibi --version    # Print version information and exit

Keyboard shortcuts

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


Global configuration

Kibi can be configured using configuration files. The location of these files is described below.

  • Linux / macOS:
    • /etc/kibi/config.ini (system-wide configuration file)
    • A user-level configuration file can be located located at:
      • $XDG_CONFIG_HOME/kibi/config.ini if environment variable $XDG_CONFIG_HOME is defined
      • ~/.config/kibi/config.ini otherwise
  • Windows:
    • %APPDATA%\kibi\config.ini

Example configuration file:

# The size of a tab. Must be > 0.
# The number of confirmations needed before quitting, when changes have been made since the file.
# was last changed.
# The duration for which messages are shown in the status bar, in seconds.
# Whether to show line numbers.

Syntax Highlighting

Syntax highlighting can be configured using INI files located at:

  • Linux / macOS:
    • /etc/kibi/syntax.d/<file_name>.ini for system-wide availability
    • For user-level configuration files:
      • $XDG_CONFIG_HOME/kibi/syntax.d/<file_name>.ini if environment variable $XDG_CONFIG_HOME is defined
      • ~/.config/kibi/syntax.d/<file_name>.ini otherwise
  • Windows:
    • %APPDATA%\kibi\syntax.d\<file_name>.ini

Syntax highlighting configuration follows this format:

### /etc/kibi/syntax.d/rust.ini ###
# Kibi syntax highlighting configuration for Rust

multiline_comment_delims=/*, */
; In Rust, the multi-line string delimiter is the same as the single-line string delimiter
keywords_1=abstract, as, async, await, become, box, break, const, continue, crate, do, dyn, else, enum, extern, false, final, fn, for, if, impl, in, let, loop, macro, match, mod, move, mut, override, priv, pub, ref, return, self, Self, static, struct, super, trait, true, try, type, typeof, unsafe, unsized, use, virtual, where, while, yield
keywords_2=i8, i16, i32, i64, i128, isize, u8, u16, u32, u36, u128, usize, f32, f64, bool, char, str

Comparison with kilo

This 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:

  • Support for UTF-8 characters
  • Compatible with Windows
  • Command to jump to a given row/column
  • Handle window resize (UNIX only)
  • Parsing configuration files: global editor configuration, language-specific syntax highlighting configuration
  • Display line numbers on the left of the screen; display file size in the status bar
  • Syntax highlighting: multi-line strings
  • Save as prompt when no file name has been provided
  • Command to duplicate the current row
  • Memory safety, thanks to Rust!
  • Many bug fixes


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. Safe wrappers are preferred to avoid using unsafe code as much as possible:

  • On UNIX systems (Linux, macOS):
    • libc
    • nix
    • signal-hook
  • On Windows:
    • winapi
    • winapi-util

In 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.

Why Kibi?

  1. Porting the kilo source code from C to Rust and trying to make it idiomatic was interesting
  2. Implementing new features while under the 1024-line constraint is a good challenge
  3. Most importantly, I wanted to learn Rust and this was a great project to start (thanks Reddit for the idea)


Kibi is distributed under the terms of both the MIT license and the Apache License (Version 2.0).


You can’t perform that action at this time.