shugo/textbringer

An Emacs-like text editor written in Ruby

Ruby

391

1,756 commits

updated Sep 21, 2026

See the code

README

Textbringer

LatestVer Gem Version ubuntu windows macos

Textbringer is an Emacs-like text editor written in Ruby. It is extensible by Ruby instead of Lisp.

Screenshot

Screenshot

Demo

Installation

$ gem install textbringer

You need ncursesw to use multibyte characters. Install ncursesw before installing curses.gem, on which textbringer depends.

$ sudo apt-get install libncursesw5-dev
$ gem install curses

You need ffi to use clipboard commands on Windows.

$ gem install ffi

Usage

$ txtb

You can quit the editor by Ctrl-x Ctrl-c.

Many commands and key bindings are similar to Emacs.

Type F1 b or Alt+x describe_bindings RET to see key bindings.

Configuration

Meta key

You need the following configuration of terminal emulators to use meta key.

xterm

Add the following line to ~/.Xresources.

XTerm*metaSendsEscape: true

mlterm

Add the following lines to ~/.mlterm/main.

mod_meta_key = alt
mod_meta_mode = esc

True color (24-bit color)

If your terminal emulator supports true color, set TERM to xterm-direct to enable 24-bit color.

$ TERM=xterm-direct txtb

This allows themes to display their exact hex colors instead of approximating to the 256-color palette.

East asian ambiguous width

Add the following line to ~/.textbringer.rb to treat ambiguous characters as fullwidth.

CONFIG[:east_asian_ambiguous_width] = 2

You also need a LD_PRELOAD hack or a modified locale charmap because ncursesw uses wcwidth(3).

xterm, mlterm and screen have their own configuration options.

xterm

Add the following lines to ~/.Xresources.

xterm*utf8: 1
xterm*locale: true
xterm*cjkWidth: true

mlterm

Add the following line to ~/.mlterm/main.

col_size_of_width_a = 2

screen

Add the following line to ~/.screenrc.

cjkwidth on

Plugins

Themes

Type Alt+x load_theme RET to load a theme from textbringer/themes or ~/.textbringer/themes.

Themes can also be loaded in ~/.textbringer.rb.

load_theme "catppuccin"

If a theme sets its own background color but you prefer to use the terminal's default background, add the following after load_theme:

set_background_color "default"

Development

After checking out the repo, run bundle install to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To run the tests, run bundle exec rake test. To install this gem onto your local machine, run bundle exec rake install.

To release a new version, run bundle exec rake bump on a clean main branch. It increments the version number in version.rb, commits and pushes the change, and pushes a v<N> tag. The tag triggers the push_gem.yml workflow, which publishes the gem to rubygems.org via trusted publishing and creates a GitHub release. Do not run bundle exec rake release; it would try to push the gem from your machine as well.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/shugo/textbringer.

License

The gem is available as open source under the terms of the MIT License.

elric-saga
ruby
textbringer
text-editor

Contributors

shugo

1,699 commits

dependabot[bot]

24 commits

Copilot

12 commits

shugo/textbringer

An Emacs-like text editor written in Ruby

Ruby

391

1,756 commits

updated Sep 21, 2026

See the code

README

Textbringer

LatestVer Gem Version ubuntu windows macos

Textbringer is an Emacs-like text editor written in Ruby. It is extensible by Ruby instead of Lisp.

Screenshot

Screenshot

Demo

Installation

$ gem install textbringer

You need ncursesw to use multibyte characters. Install ncursesw before installing curses.gem, on which textbringer depends.

$ sudo apt-get install libncursesw5-dev
$ gem install curses

You need ffi to use clipboard commands on Windows.

$ gem install ffi

Usage

$ txtb

You can quit the editor by Ctrl-x Ctrl-c.

Many commands and key bindings are similar to Emacs.

Type F1 b or Alt+x describe_bindings RET to see key bindings.

Configuration

Meta key

You need the following configuration of terminal emulators to use meta key.

xterm

Add the following line to ~/.Xresources.

XTerm*metaSendsEscape: true

mlterm

Add the following lines to ~/.mlterm/main.

mod_meta_key = alt
mod_meta_mode = esc

True color (24-bit color)

If your terminal emulator supports true color, set TERM to xterm-direct to enable 24-bit color.

$ TERM=xterm-direct txtb

This allows themes to display their exact hex colors instead of approximating to the 256-color palette.

East asian ambiguous width

Add the following line to ~/.textbringer.rb to treat ambiguous characters as fullwidth.

CONFIG[:east_asian_ambiguous_width] = 2

You also need a LD_PRELOAD hack or a modified locale charmap because ncursesw uses wcwidth(3).

xterm, mlterm and screen have their own configuration options.

xterm

Add the following lines to ~/.Xresources.

xterm*utf8: 1
xterm*locale: true
xterm*cjkWidth: true

mlterm

Add the following line to ~/.mlterm/main.

col_size_of_width_a = 2

screen

Add the following line to ~/.screenrc.

cjkwidth on

Plugins

Themes

Type Alt+x load_theme RET to load a theme from textbringer/themes or ~/.textbringer/themes.

Themes can also be loaded in ~/.textbringer.rb.

load_theme "catppuccin"

If a theme sets its own background color but you prefer to use the terminal's default background, add the following after load_theme:

set_background_color "default"

Development

After checking out the repo, run bundle install to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To run the tests, run bundle exec rake test. To install this gem onto your local machine, run bundle exec rake install.

To release a new version, run bundle exec rake bump on a clean main branch. It increments the version number in version.rb, commits and pushes the change, and pushes a v<N> tag. The tag triggers the push_gem.yml workflow, which publishes the gem to rubygems.org via trusted publishing and creates a GitHub release. Do not run bundle exec rake release; it would try to push the gem from your machine as well.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/shugo/textbringer.

License

The gem is available as open source under the terms of the MIT License.

elric-saga
ruby
textbringer
text-editor

Contributors

shugo

1,699 commits

dependabot[bot]

24 commits

Copilot

12 commits

Languages

Ruby

98.8%