a small yet mighty GNU Emacs style editor

Kevin "The Nuclear" Bloom 5bf9c4f701 fixed an issue with backquote in shell commands 1 rok pred
docs 6a89799bc8 init 2 rokov pred
scripts 1744ef07d2 fixed bug with shell command not likely single quotes 1 rok pred
.gitignore 80fa94f2c1 use spaces instead of tabs 1 rok pred
AE_LICENSE e97a1e4a48 licenses 2 rokov pred
BSD_LICENSE e97a1e4a48 licenses 2 rokov pred
LICENSE df3f388468 fixed a few things 2 rokov pred
README.md a38963daa4 updated README 1 rok pred
TODO.md 90c3c24e08 added a special versions file 1 rok pred
buffer.c d8a28872ea fixed bug with opening buffers with same name 1 rok pred
command.c 1afa42dca0 fixed a few undoing issues 1 rok pred
complete.c 239cc74961 clear msgline with C-g 1 rok pred
display.c 9c10508204 added extension-based highlight for comments and strings 1 rok pred
gap.c 59cd420259 fixed another undo issue, fixed some warnings, added better hilite 1 rok pred
header.h e4ff5b881a redraw if number of windows changes 1 rok pred
hilite.c 59cd420259 fixed another undo issue, fixed some warnings, added better hilite 1 rok pred
key.c 410ec0629d can cancel C-x with C-g now 1 rok pred
main.c e4ff5b881a redraw if number of windows changes 1 rok pred
makefile 7119a34736 can input shell commands, can only open files with commands 1 rok pred
replace.c 5003c5f400 update the screen when replacing 1 rok pred
search.c cdfbd3d33f fixed isearch recentering 1 rok pred
shell.c 5bf9c4f701 fixed an issue with backquote in shell commands 1 rok pred
termbox.h 4d046dae3f added pseudo-support for wsvt25 ttys 1 rok pred
util.c 80fa94f2c1 use spaces instead of tabs 1 rok pred
util.h 0a2b5b4780 highlight matching bracket 2 rokov pred
versions.md 90c3c24e08 added a special versions file 1 rok pred
window.c 59b3f1cbec fixed close window bug 1 rok pred

README.md

Ait - a simple, portable, and small GNU Emacs style editor

Ait is inspired by GNU Emacs and mle. Based on Atto. Started as a fork of Atto but was then ported to Termbox2 to become what it is now. Ait can be compiled with no dependencies other than libc. It should work on all unix-like systems although I've only tried it on GNU/Linux (glibc), MacOS, and NetBSD. Ait works best in terminal emulators but it can be used in the tty on GNU/Linux.

Features

  • Emacs-like keybindings (see key.c)
  • basic window/buffer support
  • isearch
  • find/replace
  • M-x to run shell commands
    • shell commands are either inserted at the point or replace the region. For example, if you ran the scripts/spell command on a word, it would replace the word.
  • M-o to open files with external command
  • basic unlimited undo
  • keyboard macros
  • jump/zap to char
  • bracket highlighting
  • basic syntax highlighting (see buffer.c & hilite.c)

Goals

  • suckless simplicity
  • portability
  • reasonably small
  • support the core GNU Emacs keybinding
  • UTF8 & unicode
  • don't reinvent the wheel
  • don't suck

Non-goals

  • customizability
  • extension language
  • be Emacs
  • be Vim
  • IDE-like features
  • rewriting things that work

Abstract

The purpose of this editor is to be similar enough to Emacs but without the extra stuff. It focuses on using the existing system to do things, and having smaller foot without lacking in important editor features. To do this, most of the keybindings are the vanilla Emacs bindings with a few exceptions, having similar buffer and cursor controls, and having a familiar look. Instead of rewriting everything in C, ait allows you to use shell commands as an pseudo-extension language. See scripts/ for more information.

The codebase comes from 2 other authors, most of which was written back in the 90s. That being said, some of the code is clearly outdated but since it works, I have no desire to rewrite it. There is also no reason for me to support things that I don't actually use or things that can easily be done using an existing function. For example, multiple cursors is really great but a complicated feature to add when most situations can be solved using keyboard macros.

Why the name Ait?

Ait stands for Atto In Termbox or Atto Implemented in Termbox. Also, an ait is a small island usually found in rivers. I thought about calling it simply At but there is already a program called at1 2 3 4 5. My wife also came up with the name of aint, standing for Atto IN Termbox and having the catch phrase of "because it ain't your editor."

Derivation

From Atto's README: "Atto is based on the public domain code of Anthony Howe's editor (commonly known as Anthony's Editor or AE, [2]). Rather than representing a file as a linked list of lines, the AE Editor uses the concept of a Buffer-Gap [4,5,6]. A Buffer-Gap editor stores the file in a single piece of contiguous memory with some extra unused space known as the buffer gap. On character insertion and deletion the gap is first moved to the current point. A character deletion then extends the gap by moving the gap pointer back by 1 OR the gap is reduced by 1 when a character is inserted. The Buffer-Gap technique is elegant and significantly reduces the amount of code required to load a file, modify it and redraw the display. The proof of this is seen when you consider that Atto supports almost the same command set that Pico supports, but Pico requires almost 17 times the amount of code."

Ait comes from Atto so the derivation is trival. I just ported it to termbox and started hacking in my own changes for fun.

Known Issues

See TODO.md. This editor is in it's infancy so a lot of bugs are bound to happen. It also is no where near as powerful as editors with an actual userbase.

Copying

Ait code is released under the BSD 3-Clause License. Atto code is released to the public domain. Anthony's Editor code claims to be public domain but contains a questionable (see AE_LICENSE) license that isn't actually public domain. See the LICENSE file for the offical statements.

Acknowledgements

Hugh Barney for writing Atto.

Anthony Howe for writing Anthony's Editor.

GNU Emacs for keybindings, power, and inspritation.

mle for inspiration.

Termbox for being nice.

Adam Saponara for making the previous 2.