zee
zee copied to clipboard
A modern text editor for the terminal written in Rust
Zee is a modern editor for the terminal, in the spirit of Emacs. It is written in Rust and it is somewhat experimental.
In the old tradition of text editor demos, here's what it currently looks like editing its own source code

features
- The 100 FPS editor. Cursor movement and edits render under 10ms. Everything else happens asynchronously (syntax parsing and highlighting, IO to/from disk, file pickers).
- Buffers are backed by a fast B-tree implementation of a rope (via cessen's ropey).
- Edit tree history, aka. undo/redo tree
- Uses Tree-sitter for generating a parse tree from your code. This AST is used for syntax highlighting and on the fly validation. As it is an incremental parsing library, it scales to files with 1 million lines of code.
- multi-buffer, multi-pane -- shared state beats tmux with multiple editors
- fast recursive file search with fuzzy matching and aware of ignore files (using BurntSushi's ripgrep crates walkdir, ignore)
- local file picker with directory navigation
- a pragmatic editor, not a research endeavour into CRDTs
getting started
The recommended way to install zee is using cargo
cargo install --locked zee
To start the editor run zee. As expected, you can pass in one or multiple files to be opened, e.g. zee file1 file2.
install options
To enable integration with your system's clipboard, install zee with the system-clipboard feature
cargo install --locked --features system-clipboard zee
To build with clipboard support, you'll additionally need x11 bindings on Linux. On a Debian-y distribution, you can install them like this
sudo apt install xorg-dev libxcb-shape0-dev libxcb-xfixes0-dev
nightly version
To install the latest version directly from the official repository, just run the following command:
cargo install --git https://github.com/zee-editor/zee
Important: please note that the code base state fetched by this instruction could contain work-in-progress features which might need some further maintenance before being included in the release of the next stable version.
configuration
Zee is customised using a config.ron file inside the configuration directory.
To create the default configuration file, use the --init command line argument.
zee --init
If config.ron doesn't already exist, zee --init will create a fresh configuration file with comments, ready to be edited.
The exact location of the configuration directory is system specific, e.g. ~/.config/zee on Linux or macOS
and %AppData%/zee on Windows. The location of the configuration directory can be overwritten by setting the environment variable ZEE_CONFIG_DIR.
ZEE_CONFIG_DIR=/home/user/.zee zee --init --build
This command will initialise a configuration directory at /home/user/.zee and immediately download and build the configured tree sitter parsers. See below details on the --build command line argument.
syntax highlighting
Zee uses Tree-sitter parsers for syntax highlighting and on the fly validation of source code. Each tree sitter parser is compiled to a shared object which is linked dynamically. To download and build the parsers, simply run
zee --build
The parsers are downloaded, compiled and placed in a grammars directory inside the config
directory. The exact location is system specific, e.g. ~/.config/zee/grammars on Linux or macOS
and %AppData%/zee/grammars on Windows.
The parsers are either the ones configured in the config.ron file or the
default ones if no configuration file is found.
If you change the parsers in the config.ron file, you'll have to re-run the build command.
building from source
Zee is written in Rust and it requires the latest stable compiler to build. You can use cargo to build it as you'd expect
git clone https://github.com/zee-editor/zee.git && cd zee
cargo run -- zee/src/main.rs
The editor also depends on tree sitter parsers, one for each supported language, see configuration. Each tree sitter parser is compiled to a shared object which is linked dynamically.
Running cargo build downloads and builds this parsers just to ensure
everything works correctly. You can skip this step by setting
ZEE_DISABLE_GRAMMAR_BUILD, e.g.
ZEE_DISABLE_GRAMMAR_BUILD=t cargo run -- zee/src/main.rs
usage
To start the editor run zee. As expected, you can pass in one or multiple files to be opened,
e.g. zee file1 file2.
Zee uses Emacs-y keybindings. Feeling at home with the default Emacs bindings is a goal of the project.
Below, C- means Ctrl + the specified key, e.g. C-k is Ctrl + k. Similarly A- means
Alt + the specified key. Empty spaces denote a sequence of key presses, e.g. C-x C-c means
first pressing C-x followed by C-c.
The following keybindings are available
movement
C-f,Rightmove forwardC-b,Leftmove backwardC-n,Downmove downC-p,Upmove upA-fmove forward by one wordA-bmove backward by one wordA-nmove forward by one paragraphA-pmove backward by one paragraphC-a,Homemove to start of lineC-e,Endmove to end of lineC-v,PageDownmove down one pageA-v,PageUpmove up one pageA-<move to the beginning of the bufferA->move to the end of the bufferC-lcentre the cursor visually
editing
C-ddelete forwardsBackspacedelete backwardsC-kdelete the current lineC-SPCenter selection mode at the current cursor positionC-wcut selectionA-wcopy selectionC-x hselect the entire buffer and move the cursor to the beginningC-ypaste selection (yank in Emacs)C-gclear the current selectionC-_,C-z,C-/undo previous commandC-qredo previous commandC-x uopen the edit tree viewerEnterinsert a new line, moving the cursorC-oinsert a new line after the cursor, without moving itC-x C-ssave the current buffer
file navigation
C-x C-fchoose a file to open using a directory-level pickerC-x C-vsearch recursively for a file to open from the selected directoryC-lwhile opening a file, go to the parent directoryTabwhile opening a file, fills in the currently selected path
edit tree viewer
C-p,Upmove up the tree to an older revision, undoing the commandC-n,Downmove down the tree to a newer revision, redoing the commandC-b,Leftselect the left child of current revisionC-f,Rightselect the right child of current revision
global
C-gcancel the current operationC-x kchoose a buffer to closeC-x bswitch the current window to another bufferC-x 0,C-x C-0close the focused windowC-x 1,C-x C-1make the focused window fullscreenC-x 2,C-x C-2split the focused window belowC-x 3,C-x C-3split the focused window to the rightC-x o,C-x C-oswitch focus to the next bufferC-x C-tcycle through the available themesC-x C-cquit
license
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your discretion.
contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.