Code Monkey home page Code Monkey logo

zee's Introduction

Zi logo

Build Status Crates.io

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

Peek 2020-03-09 00-16

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, Right move forward
  • C-b, Left move backward
  • C-n, Down move down
  • C-p, Up move up
  • A-f move forward by one word
  • A-b move backward by one word
  • A-n move forward by one paragraph
  • A-p move backward by one paragraph
  • C-a, Home move to start of line
  • C-e, End move to end of line
  • C-v, PageDown move down one page
  • A-v, PageUp move up one page
  • A-< move to the beginning of the buffer
  • A-> move to the end of the buffer
  • C-l centre the cursor visually

editing

  • C-d delete forwards
  • Backspace delete backwards
  • C-k delete the current line
  • C-SPC enter selection mode at the current cursor position
  • C-w cut selection
  • A-w copy selection
  • C-x h select the entire buffer and move the cursor to the beginning
  • C-y paste selection (yank in Emacs)
  • C-g clear the current selection
  • C-_, C-z, C-/ undo previous command
  • C-q redo previous command
  • C-x u open the edit tree viewer
  • Enter insert a new line, moving the cursor
  • C-o insert a new line after the cursor, without moving it
  • C-x C-s save the current buffer

file navigation

  • C-x C-f choose a file to open using a directory-level picker
  • C-x C-v search recursively for a file to open from the selected directory
  • C-l while opening a file, go to the parent directory
  • Tab while opening a file, fills in the currently selected path

edit tree viewer

  • C-p, Up move up the tree to an older revision, undoing the command
  • C-n, Down move down the tree to a newer revision, redoing the command
  • C-b, Left select the left child of current revision
  • C-f, Right select the right child of current revision

global

  • C-g cancel the current operation
  • C-x k choose a buffer to close
  • C-x b switch the current window to another buffer
  • C-x 0, C-x C-0 close the focused window
  • C-x 1, C-x C-1 make the focused window fullscreen
  • C-x 2, C-x C-2 split the focused window below
  • C-x 3, C-x C-3 split the focused window to the right
  • C-x o, C-x C-o switch focus to the next buffer
  • C-x C-t cycle through the available themes
  • C-x C-c quit

license

This project is licensed under either of

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.

zee's People

Contributors

iainh avatar kevinmatthes avatar ksxgithub avatar mcobzarenco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zee's Issues

[Bug] Copy and Paste without System Clipboard not Working

With the latest Nightly Version, it is not possible anymore to copy and paste selections when there is no integration of the system keyboard. Since the version on crates.io has this feature instead, I would consider its missing a bug.

Crash on empty git repo

$ cargo install zee
....
$ cargo new anynewproject
     Created binary (application) `anynewproject` package
$ zee anynewproject/src/main.rs 
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -9, klass: 4, message: "reference 'refs/heads/master' not found" }', /home/tommy/.cargo.x86_64-linux/registry/src/github.com-1ecc6299db9ec823/zee-0.1.2/src/components/buffer.rs:529:67
               note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
                                                                                            Aborted (core dumped)

Help Keybind

Hi everybody,

A suggestion for a new keybinding might be ctrl+h that outputs or opens a file with all the available keybindings. Useful for new users.

[Bug] Unable to install zee with the system-clipboard feature enabled

System information

OS: FreeBSD
OS version: 13.1-RELEASE-p2
cargo --version: 1.63.0

Steps to reproduce

cargo install --locked --features system-clipboard zee
    Updating crates.io index
  Installing zee v0.3.2
   Compiling libc v0.2.124
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.37
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.91
   Compiling cfg-if v1.0.0
   Compiling serde_derive v1.0.136
   Compiling serde v1.0.136
   Compiling memchr v2.4.1
   Compiling crossbeam-utils v0.8.8
   Compiling pkg-config v0.3.25
   Compiling log v0.4.16
   Compiling version_check v0.9.4
   Compiling rayon-core v1.9.2
   Compiling getrandom v0.1.16
   Compiling lazy_static v1.4.0
   Compiling scopeguard v1.1.0
   Compiling futures-core v0.3.21
   Compiling bitflags v1.3.2
   Compiling regex-syntax v0.6.25
   Compiling anyhow v1.0.57
   Compiling ppv-lite86 v0.2.16
   Compiling futures-channel v0.3.21
   Compiling zee-grammar v0.3.0
   Compiling siphasher v0.3.10
   Compiling futures-task v0.3.21
   Compiling signal-hook v0.3.13
   Compiling futures-util v0.3.21
   Compiling tinyvec_macros v0.1.0
   Compiling pin-project-lite v0.2.8
   Compiling futures-sink v0.3.21
   Compiling parking_lot_core v0.9.2
   Compiling slab v0.4.6
   Compiling matches v0.1.9
   Compiling lexical-core v0.7.6
   Compiling typenum v1.15.0
   Compiling once_cell v1.10.0
   Compiling either v1.6.1
   Compiling ryu v1.0.9
   Compiling str_indices v0.3.2
   Compiling futures-io v0.3.21
   Compiling proc-macro-hack v0.5.19
   Compiling itoa v1.0.1
   Compiling pin-utils v0.1.0
   Compiling serde_json v1.0.79
   Compiling unicode-segmentation v1.9.0
   Compiling unicode-bidi v0.3.7
   Compiling static_assertions v1.1.0
   Compiling percent-encoding v2.1.0
   Compiling rustversion v1.0.6
   Compiling base64 v0.13.0
   Compiling unicode-width v0.1.9
   Compiling arrayvec v0.5.2
   Compiling fnv v1.0.7
   Compiling time-macros v0.2.4
   Compiling hashbrown v0.11.2
   Compiling same-file v1.0.6
   Compiling bytes v1.1.0
   Compiling gimli v0.26.1
   Compiling os_str_bytes v6.0.0
   Compiling adler v1.0.2
   Compiling heck v0.4.0
   Compiling openssl-probe v0.1.5
   Compiling glob v0.3.0
   Compiling termcolor v1.1.3
   Compiling textwrap v0.15.0
   Compiling strsim v0.10.0
   Compiling rustc-demangle v0.1.21
   Compiling ansi_term v0.12.1
   Compiling maplit v1.0.2
   Compiling crossclip v0.7.0
   Compiling libloading v0.7.3
   Compiling memoffset v0.6.5
   Compiling crossbeam-epoch v0.9.8
   Compiling num-traits v0.2.14
   Compiling rayon v1.5.2
   Compiling num-integer v0.1.44
   Compiling lock_api v0.4.7
   Compiling num-iter v0.1.42
   Compiling num-rational v0.2.4
   Compiling num-complex v0.2.4
   Compiling indexmap v1.8.1
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling nom v5.1.2
   Compiling phf_shared v0.8.0
   Compiling tinyvec v1.5.1
   Compiling thread_local v1.1.4
   Compiling form_urlencoded v1.0.1
   Compiling walkdir v2.3.2
   Compiling clap_lex v0.1.1
   Compiling miniz_oxide v0.5.1
   Compiling addr2line v0.17.0
   Compiling fuzzy-matcher v0.3.7
   Compiling phf v0.8.0
   Compiling unicode-normalization v0.1.19
   Compiling jobserver v0.1.24
   Compiling num_cpus v1.13.1
   Compiling atty v0.2.14
   Compiling dirs-sys v0.3.7
   Compiling signal-hook-registry v1.4.0
   Compiling num_threads v0.1.5
   Compiling quote v1.0.18
   Compiling crossbeam-channel v0.5.4
   Compiling aho-corasick v0.7.18
   Compiling bstr v0.2.17
   Compiling object v0.28.3
   Compiling mio v0.8.2
   Compiling generic-array v0.12.4
   Compiling pkg-version-impl v0.1.1
   Compiling cc v1.0.73
   Compiling rand_core v0.5.1
   Compiling idna v0.2.3
   Compiling colored v2.0.0
   Compiling dirs v4.0.0
   Compiling time v0.3.9
   Compiling euclid v0.22.7
   Compiling approx v0.3.2
   Compiling regex v1.5.5
   Compiling pkg-version v1.0.0
   Compiling rand_chacha v0.2.2
   Compiling rand_pcg v0.2.1
   Compiling tree-sitter v0.20.6
   Compiling openssl-sys v0.9.72
   Compiling libz-sys v1.1.5
   Compiling libssh2-sys v0.2.23
   Compiling libgit2-sys v0.13.2+1.4.2
   Compiling backtrace v0.3.65
   Compiling url v2.2.2
   Compiling signal-hook-mio v0.2.3
   Compiling crossbeam-deque v0.8.1
   Compiling globset v0.4.8
   Compiling rand v0.7.3
   Compiling num v0.2.1
   Compiling ignore v0.4.18
   Compiling futures-macro v0.3.21
   Compiling thiserror-impl v1.0.30
   Compiling tokio-macros v1.7.0
   Compiling palette_derive v0.5.0
   Compiling clap_derive v3.1.7
   Compiling phf_generator v0.8.0
   Compiling size_format v1.0.2
   Compiling tokio v1.17.0
   Compiling thiserror v1.0.30
   Compiling phf_codegen v0.8.0
   Compiling clap v3.1.12
   Compiling flexi_logger v0.22.3
   Compiling palette v0.5.0
   Compiling futures-executor v0.3.21
   Compiling smallvec v1.8.0
   Compiling serde_regex v1.1.0
   Compiling toml v0.5.9
   Compiling ron v0.7.0
   Compiling futures v0.3.21
   Compiling ropey v1.4.1
   Compiling smallstr v0.3.0
   Compiling zee-highlight v0.3.0
   Compiling zee v0.3.2
   Compiling parking_lot v0.12.0
   Compiling zi v0.3.2
   Compiling zee-edit v0.1.0
   Compiling crossterm v0.23.2
   Compiling zi-term v0.3.2
   Compiling git2 v0.14.2
error[E0433]: failed to resolve: could not find `SystemClipboard` in `crossclip`
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/zee-0.3.2/src/clipboard.rs:38:38
   |
38 |             let context = crossclip::SystemClipboard::new()?;
   |                                      ^^^^^^^^^^^^^^^ could not find `SystemClipboard` in `crossclip`

error[E0412]: cannot find type `SystemClipboard` in crate `crossclip`
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/zee-0.3.2/src/clipboard.rs:33:36
   |
33 |         context: RwLock<crossclip::SystemClipboard>,
   |                                    ^^^^^^^^^^^^^^^ not found in `crossclip`

Some errors have detailed explanations: E0412, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `zee` due to 2 previous errors
error: failed to compile `zee v0.3.2`, intermediate artifacts can be found at `/tmp/cargo-installmCT4R4`

Expected behaviour

Install zee with the system-clipboard feature enabled.

Heresy - modal key bindigs?

I like simple but highly effective things like zee. Despite my general dislike of modal interfaces, with text editing it's the opposite ๐Ÿ˜‰.

Therefore my heretical question - would you be willing to support modal key bindings?

[Bug] Colour Mapping of `Base16Theme` Differs from Default Theme

This issue is related to #79.

When working on #81, I noticed several major differences between the ways the colours are mapped in the default theme, zee-gruvbox, and how the colours of the Base16Theme-defined schemes are mapped onto the editor's components.

One example is that the highlight colour for the current line is fetched from the selection colour in zee-gruvbox, giving the status bar a colour on its own, while all other themes are defined such that the selection colour is on its own while the current line and the status bar share their background colours.

Since this procedure is not uniform I would consider this a bug.

`cargo install zee` fails with errors

Hi,

I was following the recommended steps in your README, running cargo install zee (or cargo +nightly install zee), but both resulted in the same errors:

โฏ cargo +nightly install zee
    Updating crates.io index
  Installing zee v0.1.2
   Compiling autocfg v1.1.0
   Compiling memchr v2.4.1
   Compiling jobserver v0.1.24
   Compiling serde v1.0.136
   Compiling winapi v0.3.9
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.90
   Compiling lazy_static v1.4.0
   Compiling cfg-if v1.0.0
   Compiling version_check v0.9.4
   Compiling serde_json v1.0.79
   Compiling pkg-config v0.3.25
   Compiling libc v0.2.121
   Compiling vcpkg v0.2.15
   Compiling serde_derive v1.0.136
   Compiling regex-syntax v0.6.25
   Compiling crossbeam-utils v0.8.8
   Compiling bitflags v1.3.2
   Compiling log v0.4.16
   Compiling scopeguard v1.1.0
   Compiling itoa v1.0.1
   Compiling ryu v1.0.9
   Compiling cfg-if v0.1.10
   Compiling tinyvec_macros v0.1.0
   Compiling lexical-core v0.7.6
   Compiling proc-macro-hack v0.5.19
   Compiling typenum v1.15.0
   Compiling rayon-core v1.9.1
   Compiling matches v0.1.9
   Compiling static_assertions v1.1.0
   Compiling once_cell v1.10.0
   Compiling maybe-uninit v2.0.0
   Compiling arrayvec v0.5.2
   Compiling percent-encoding v2.1.0
   Compiling unicode-width v0.1.9
   Compiling unicode-bidi v0.3.7
   Compiling fnv v1.0.7
   Compiling unicode-segmentation v1.9.0
   Compiling anyhow v1.0.56
   Compiling vec_map v0.8.2
   Compiling num_cpus v1.13.1
   Compiling hashbrown v0.11.2
   Compiling strsim v0.8.0
   Compiling glob v0.3.0
   Compiling yansi v0.5.1
   Compiling str_indices v0.3.2
   Compiling smart-ptr v0.4.1
   Compiling either v1.6.1
   Compiling numtoa v0.1.0
   Compiling maplit v1.0.2
   Compiling cc v1.0.73
   Compiling tinyvec v1.5.1
   Compiling lock_api v0.3.4
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling nom v5.1.2
   Compiling num-traits v0.2.14
   Compiling num-integer v0.1.44
   Compiling memoffset v0.6.5
   Compiling crossbeam-epoch v0.9.8
   Compiling num-rational v0.2.4
   Compiling num-complex v0.2.4
   Compiling num-iter v0.1.42
   Compiling indexmap v1.8.1
   Compiling crossbeam-utils v0.7.2
   Compiling rayon v1.5.1
   Compiling textwrap v0.11.0
   Compiling thread_local v1.1.4
   Compiling form_urlencoded v1.0.1
   Compiling heck v0.3.3
   Compiling fuzzy-matcher v0.3.7
   Compiling termion v1.5.6
   Compiling crossbeam-channel v0.5.4
   Compiling aho-corasick v0.7.18
error[E0433]: failed to resolve: maybe a missing crate `sys`?
  --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\lib.rs:24:9
   |
24 | pub use sys::size::terminal_size;
   |         ^^^ maybe a missing crate `sys`?

error[E0433]: failed to resolve: maybe a missing crate `sys`?
  --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\lib.rs:27:9
   |
27 | pub use sys::tty::{is_tty, get_tty};
   |         ^^^ maybe a missing crate `sys`?

error[E0433]: failed to resolve: maybe a missing crate `sys`?
 --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\async.rs:5:5
  |
5 | use sys::tty::get_tty;
  |     ^^^ maybe a missing crate `sys`?

error[E0433]: failed to resolve: maybe a missing crate `sys`?
  --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:28:5
   |
28 | use sys::attr::{get_terminal_attr, raw_terminal_attr, set_terminal_attr};
   |     ^^^ maybe a missing crate `sys`?

error[E0432]: unresolved import `sys`
  --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:29:5
   |
29 | use sys::Termios;
   |     ^^^ maybe a missing crate `sys`?

error[E0425]: cannot find function `get_tty` in this scope
  --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\async.rs:14:36
   |
14 |     thread::spawn(move || for i in get_tty().unwrap().bytes() {
   |                                    ^^^^^^^ not found in this scope

error[E0425]: cannot find function `get_tty` in this scope
  --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\async.rs:43:36
   |
43 |     thread::spawn(move || for i in get_tty().unwrap().bytes() {
   |                                    ^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
  --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:45:9
   |
45 |         set_terminal_attr(&self.prev_ios).unwrap();
   |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `get_terminal_attr` in this scope
   --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:102:23
    |
102 |         let mut ios = get_terminal_attr()?;
    |                       ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `raw_terminal_attr` in this scope
   --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:105:9
    |
105 |         raw_terminal_attr(&mut ios);
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
   --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:107:9
    |
107 |         set_terminal_attr(&ios)?;
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
   --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:119:9
    |
119 |         set_terminal_attr(&self.prev_ios)?;
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `get_terminal_attr` in this scope
   --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:125:23
    |
125 |         let mut ios = get_terminal_attr()?;
    |                       ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `raw_terminal_attr` in this scope
   --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:126:9
    |
126 |         raw_terminal_attr(&mut ios);
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function `set_terminal_attr` in this scope
   --> C:\Users\rb\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.6\src\raw.rs:127:9
    |
127 |         set_terminal_attr(&ios)?;
    |         ^^^^^^^^^^^^^^^^^ not found in this scope

   Compiling bstr v0.2.17
Some errors have detailed explanations: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `termion` due to 15 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `zee v0.1.2`, intermediate artifacts can be found at `C:\Users\rb\AppData\Local\Temp\cargo-installUwWzCg`

Caused by:
  build failed

If I had to take a wild guess it's probably because termion doesn't support Windows (IIRC). If so, it would be nice if you could state which platforms you support next to your install instructions.

[Bug] Whitespace Cropping Triggers Colour Panic

When working on the changes I submitted with #41, I noticed an important bug.

zee is able to automatically crop obsolete whitespaces, this is, whitespaces at the end of a line without any need such as additional spaces and tab characters. When saving the current buffer, zee will enter a panic state best described with "Colour Panic": any lexemes do not need to be coloured correctly any longer and the parser will find syntax issues in lines which do not have such.

If one keeps the editor open while zee has a "Colour Panic", it might break due to it. This happened to me when editing zee/src/components/theme/base16.rs and pressing [TAB] once at the end of a line of a block comment for a field of the Base16Theme structure. To reproduce, add such an obsolete tab insertion, save, scroll completely down and up again, and repeat once. This broke my compilation after two rounds with insert_spaces_for_tab = true and theme_name = "base16-vscode-dark".

The same "Colour Panic" is achieved when only viewing this repository's README. Scroll some rounds slowly over the file and you will see that the colourisation fails. This behaviour can be reproduced not only with the VSCODE_DARK theme but also the default one. I quit the editor before it could break but the "Colour Panic" seems to be a symptom that there might be an internal bug hiding in the colourisation logic.

Intended extensibility mechanism?

I'm curious whether any thought has been given to extensibility yet. Given the emacs references, of course using a lisp seems appropriate, but with Neovim using Lua and VSCode using (Java|Type)script, that might close off future avenues of interoperability.

[Project Idea] Introduce Github discussions, gitter, or similar?

I've been wondering whether there might be value in enabling Github discussions or setting up gitter or something similar to allow for an additional channel of discussion of up coming changes, project development questions, or announcing when you are working on something that isn't ready for a PR to avoid duplicate efforts. Any interest in this? Anything public adds an amount of moderation overhead which might out weigh the value depending how active it is. Perhaps just creating issues and self-assigning (permissions permitting) would work.

please document required packages to build the sources

I succeeded in building in Fedora Silverblue using the following steps:

rpm-ostree install gcc-c++ clang libxcb-devel
systemctl reboot
rustup update
git clone https://github.com/mcobzarenco/zee.git
cd zee
git submodule update --init --recursive
cargo +nightly build --release

Error while installing with cargo

error[E0080]: evaluation of constant value failed
--> /home/dujan/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.4.1/src/tree/mod.rs:74:19
|
74 | const _: [(); 0 - !{
| ___________________^
75 | | // Assert alignment.
76 | | const ASSERT: bool = if align_of::() > ARC_COUNT...
77 | | align_of::() + size_of::()
... |
81 | | ASSERT
82 | | } as usize] = [];
| |______________^ attempt to compute 0_usize - 1_usize, which would overflow

For more information about this error, try rustc --explain E0080.
error: could not compile ropey due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile zee v0.3.2, intermediate artifacts can be found at /tmp/cargo-install9I2Zyc

Add license

Thanks for writing an Emacs-ish editor in Rust! Due to an accident of computer science education, I prefer Emacs keybindings over vim bindings.

Could you add a license for your code to your repo, to make it clear that people are welcome to contribute?

I personally prefer the AGPL. I agree with Bruce Perens saying there are too many licenses creating license compatibility problems. That said, I'm ok with any license approved by the FSF + OSI. (Not that my opinion matters, since I'm just a random dude on the internet.)

Segmentation fault

Strangely, zee is segfaulting on me.
Right after trying to open any file, it crashes immediately.
This is a demonstration of what is happening:
Screencast from 2022-12-01 00-06-07.webm
Note that I was not able to install zee with cargo install --locked zee cause the ropey version in crates.io that zee depends on makes my build fail (see cessen/ropey#73 ), so I tried to build from source, and using cargo install --git.

Configurable key bindings

First of all, thanks for your work on zee!

I am exploring, looking for a "simple" editor to use in the terminal when I am not using my regular "IDE" editor, and zee, among the ones I tried, is the one that is actually able to work on huge files without becoming unresponsive :-)
(I want a "simple" editor but I want to be able to use it without fear on any file I stumble upon)
So, thanks for that!

That said, while I understand your focus on "emacs-compatible experience", I am unwilling to abandon the keybindings I am used to, or to be forced to use different keybindings with different editors.

I had a look at the source code and I see no way to load keybindings from a file.
I see there is a toml file that is looked up at startup but AFAICS it only provides an index into a theme.

About keybindings, AFAICS they are hardcoded in the various Component::bindings implementations.

Assuming that I did not make gross mistakes reading the code, would you accept a PR that:

  • implements a way to deserialize KeyPattern instances from strings
  • using that, implements a way to load "keybinding mappings" from the config file, falling back to the hardcoded defaults
  • passes this "mapping table" to the various Component::bindings implementations so that bindings will not be hard-coded anymore (they would be created from the loaded mapping table)

The "keybinding mappings table" would be a dictionary with commands ('static &str) as keys, where each command is one of "left", "start-of-line"...
For each command, there would be a Message, and a SmallVec of KeyPattern (the key patterns that would trigger the command).
This would make it possible to implement all the Component::bindings functions taking the mappings they need from the table instead of using hardcoded values like they do now.

I imagine that the performance impact of creating the bindings this way would be negligible.

Does this make sense?
If it does, and if you would accept this feature, I might write the PR in the next weeks (slowly, as I have a full-time job and a family).

Crash on macos: byte index out of bounds

I get this very often when I try to save a file just with C-x. I managed to replicate it with BACKTRACE==full! I hope that helps. It's also messing up my shell afterwards, so I can't use ls, everything looks garbled. I am sorry for the output format but happens because of that :)

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Byte index out of bounds: byte index 353, Rope/RopeSlice byte length 352', /Users/wizofe/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.4.1/src/rope.rs:635:41
                                                                                                                     stack backtrace:
              0:        0x104f9370f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0d1bc6b9a6cb5b34
                   1:        0x104ea1f7b - core::fmt::write::h64ddbe43c958ac83
                                                                                 2:        0x104f80d2a - std::io::Write::write_fmt::h7e453fd0bb915ce8
                              3:        0x104f8dc71 - std::panicking::default_hook::{{closure}}::hc0a95f88628ea979
                                                                                                                     4:        0x104f8e659 - std::panicking::rust_panic_with_hook::h59a745e8579c1996
                                                                             5:        0x104f93eb9 - std::panicking::begin_panic_handler::{{closure}}::h77c7cdc59f5a8e41
                                                 6:        0x104f93e39 - std::sys_common::backtrace::__rust_end_short_backtrace::hc399a88e87a79fbd
                           7:        0x104f8df85 - _rust_begin_unwind
                                                                        8:        0x1050b297f - core::panicking::panic_fmt::h0686ac972197ca01
                      9:        0x1050b2ad5 - core::result::unwrap_failed::hf19da9b6244b79be
                                                                                              10:        0x104e0176a - ropey::rope::Rope::byte_to_char::h201480d3b347e804
                                                 11:        0x104e296b1 - zee::editor::Editor::draw::{{closure}}::h2dc01d62ac518dce
           12:        0x104e25ed0 - zee::editor::Editor::draw::hd2f779eb09dc3f40
                                                                                  13:        0x104e3a900 - zee::run_editor_ui_loop::h9fa7ef6fb387438c
                             14:        0x104e44075 - zee::start_editor::hc4161be0144edf5d
                                                                                          [1]    40396 abort      RUST_BACKTRACE=full zee bench_corr.py

Performance of `strip_trailing_whitespace()`

At the moment, I am considering possible solutions to the Colour Panic bug, see #42, and came across the strip_trailing_whitespace() function, as well.

I found this implementation working identically compared to the current one:

pub fn strip_trailing_whitespace(text: Rope) -> Rope {
    text.lines()
        .map(|x| x.to_string().trim_end().to_string() + "\n")
        .collect()
}

Does this version raise the performance when changing the implementation in zee-edit/src/graphemes.rs, line 122, or is it even worse? Maybe the performance boost suffices to save the file before the exit?

Originally posted by @kevinmatthes in #58 (comment)

[Enhancement] Modular Structure of Theme Definition

As mentioned in #30 by @mcobzarenco, the colour themes shall be outsourced from the source code in future releases. With this issue, I would like to suggest a procedure on how the themes could be added very easily.

zee has a configuration directory in which the settings are stored. I would like to suggest to add a themes directory within this directory to store the themes in there. The themes themselves could be exported as RON (Rust Object Notation) files that can be added by the user. When the command to change the theme is triggered, a file selection dialogue just as for the file opening can be triggered to show the available themes and select them by name. The theme directory should be scanned for valid themes first when the selection dialogue is triggered.

Longer term, the theme directory should support subdirectories to clone Git repositories into which contain the zee themes. That way, all the current themes could saved in a new repository within this namespace as RON files and then be cloned into the configuration directory, at option.

I am looking forward for your feedback.

[Bug] File zeroed on save if you quit too quickly

When testing zee's performance when working with large files I came across an issue where a file's content can be partially of completely lost on save if you quit the application before the save operation has completed.

Steps to reproduce:

  1. Create or download a very large text file (I used http://mattmahoney.net/dc/enwik9.zip)
  2. Open the file, save it, and quit with save and quit happened very close together
  3. Notice the file is now 0 bytes

Digging into the code, it appears the following potential issues exist which together allow for zeroing the file:

  1. Files are truncated before save by File::create()
  2. strip_trailing_whitespace() slows down the save operation enough that it actually takes 5-10 seconds to write out a 953M file
  3. Exiting the application is allowed while there is an in progress save operation

My testing was done using a build of zee from the master branch on macOS 12.4 (arm64).

[Feature Request?] Incremental search

Hi,

First of all, very nice editor, I love it, but one last feature is missing for me to move out of emacs + doom (no evil mode), it is the incremental search (C-S).

Did I miss it?

Is it in the roadmap?

`cargo install zee`: undefined reference to `SSL_CTX_ctrl`

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/tmp/cargo-installxiM7vN/release/deps/zee-f2e61e3fdd4991a8.zee.0628f3a9-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/tmp/cargo-installxiM7vN/release/deps" "-L" "/tmp/cargo-installxiM7vN/release/build/libgit2-sys-3c1e7454ac05026a/out/build" "-L" "/tmp/cargo-installxiM7vN/release/build/libssh2-sys-5a563fd6ecd04cf4/out/build" "-L" "/usr/local/lib" "-L" "/tmp/cargo-installxiM7vN/release/build/tree-sitter-26aeed191a67ad45/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/home/rjzak/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/rustc5unC6b/libzee_grammar-6f2589916f0a8c03.rlib" "/tmp/rustc5unC6b/libtree_sitter-b2dcb091f8d90c9c.rlib" "/tmp/rustc5unC6b/liblibgit2_sys-79a44698b4064eb5.rlib" "/tmp/rustc5unC6b/liblibssh2_sys-fdd638e92b8b694e.rlib" "-Wl,--start-group" "-Wl,--end-group" "/home/rjzak/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-1f103368fa522bc0.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lssl" "-lcrypto" "-lz" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/rjzak/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/tmp/cargo-installxiM7vN/release/deps/zee-f2e61e3fdd4991a8" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs"
  = note: /usr/bin/ld: /tmp/rustc5unC6b/liblibgit2_sys-79a44698b4064eb5.rlib(openssl.o): in function `git_openssl_stream_global_init':
          openssl.c:(.text.git_openssl_stream_global_init+0x54): undefined reference to `SSL_CTX_ctrl'
          collect2: error: ld returned 1 exit status
          
  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

This is on Ubuntu 20.04 x86_64 with "libssl-dev" and "libgit2-dev" installed, using Rust nightly 1.61.0-nightly (65c8266 2022-03-09)

[Bug] Vanishing Separators in the Status Bar

When opening a file from the command line, the status bar shows separators next to the line / column and progress information fields. As soon as one calls the file picker using [CTRL] + [X], [CTRL] + [F], they are gone for the rest of this session. The same happens when cycling through the themes.

The sole colour scheme which is not affected by this is the default one.

Crash when spamming C-w in an empty file

To reproduce, just open an empty file and spam C-w, after a few key presses zee crashes with the following message:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', .../ropey-1.4.1/src/rope.rs:952:36
stack backtrace:
0: rust_begin_unwind at /rustc/1.59.0/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt at /rustc/1.59.0/library/core/src/panicking.rs:116:14
2: core::panicking::panic at /rustc/1.59.0/library/core/src/panicking.rs:48:5
3: <zee::components::buffer::Buffer as zee::components::Component>::reduce
4: zee::editor::Editor::handle_event
5: zee::run_editor_ui_loop
6: zee::start_editor
7: zee::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fish: Job 1, 'RUST_BACKTRACE=1 zee test.txt' terminated by signal SIGABRT (Abort)

Also, the formatting of the panic is horrible, maybe there should be a custom panic handler that first resets the terminal?

[Question] Highlighting Scheme Specification

I would like to add new modes to Zee but Tree-Sitters which actually specify a highlights.scm are pretty rare. I thought about writing them myself for the respective Tree-Sitters and suggesting them for integration into the fall-back directory.

My question is about the starting point(s) to get a basic idea of how these files should be specified, especially which minimum requirements need to be fulfilled.

[Feature Request] Add Intendation Information to Status Bar

Although this is just a "nice-to-have" functionality, it might help especially new users to become familiar with Zee: an information in the status bar which indentation settings are currently applied.

Some editors behave differently regarding the same coding language, especially when there are no official indentation conventions. This information might remind users to set their preferred indentation accordingly before continuing to make large changes in the respective source file.

Regarding the appearance and position, I would like to suggest to keep it simple with the first (majuscule) character of the respective indentation units, followed by the decimal representation of the indentation width without any delimiter. For instance, Haskell indents with S8, by default, while a language to be indented by a tab character spanning four columns would be indented by T4. A positioning next to the line and column information appears to be a sane plane.

Cargo manifest error

When I:

cargo install zee

I get this error:

error: failed to parse manifest at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/zee-0.1.2/Cargo.toml

Caused by:
invalid type: string "fat", expected a boolean for key profile.release.lto

This appears to be resolved by replacing "fat" with true in the referenced Cargo.toml file, but the build later fails:

error[E0277]: the trait bound std::option::Option<std::ffi::OsString>: std::ops::Try is not satisfied
--> .cargo/registry/src/github.com-1ecc6299db9ec823/serde_derive-1.0.136/build.rs:28:17

So I'm wondering if the problem is the version of rust and/or cargo.

~ $ cargo --version
cargo 0.20.0 (a60d185c8 2017-07-13)
~ $ rustc --version
rustc 1.19.0 (0ade33941 2017-07-17)

I cannot see anywhere a mention of the version requirements for these two.

This is on macOS 11.6.4 (Big Sur).

[Feature Request] More Detailed Documentation

Hello!

Thank you for this software! At the moment, I am trying to get started with zee but I often need to work myself through the respective implementation of a certain feature in order to get an idea of how I can interact with it. I would, hence, like to request an extension of the present documentation for future releases.

cargo doc --open gives me an overview of how the code organised but the provided information should rather be enriched with further explanations and some examples in order to provide an intuitive introduction to zee. This would also help other users new to this editor to get started very easily. Many Rust projects provide their documentation that way.

I tried to take a look at the wiki of this repository but it seem to do not be present and / or working, I was always redirected to the main page. The wiki would be another option to collect especially community driven suggestions on how to work with zee most effectively.

Finally, there is an even more detailed way to document the application: an mdbook. Large projects like just deploy their documentations with this feature.

Expanding the README is not always the best idea which is why I would recommend this option. One risks to reduce the maintainability of the README.

Which options would you prefer?

[Question] Telemetry?

Hello!

First of all, thank you for this editor!

When trying to install the latest version, this operation failed due to an OpenSSL installation being missing. What does zee need OpenSSL for? Does zee have telemetry features or why is OpenSSL a requirement for the editor?

Feature request: Improved navigation in file selector pop-up

One nice feature from helm that I like when navigating files after C-x-C-F is the ability to use the up and down arrow keys to select a file and right right and left arrow keys to navigate in and out of folder structure.

If I can, I will look into implementing this feature. No promises it will be fast though as I am rather new at Rust.

[Feature Request] Set Exit Codes when Quitting the Application

Especially for debugging, it would be a great enhancement to know for which reason the application quit. In the C world, there is the famous sysexits.h header which defines a set of causes therefore.

There is a Rust port of this header, named sysexits which implements them such that a Rust application can quit with these codes. The main function just needs to return a sysexits::ExitCode.

I would like to ask to integrate this feature since it would help a lot to handle errors and panics, and to communicate them to the users.

[Enhancement] Installation Instructions for Nightly Build

There is a possibility to install the latest -- but possibly not completely finished -- version directly from a Git repository like this one. The command is:

cargo install --git https://github.com/zee-editor/zee

This might be worth mentioning in the README since this would be useful for debugging.

[Question] Behaviour Regarding Multiple Suffixes

Some contexts require source files to have more than one suffix. These second suffixes typically originate from a build system and / or testing suites. For instance, the autotools suite often generates *.in and *.out files. Another example are the mutmut mutation tests for Python projects where the original state will be kept during the processing with *.bak backup copies of the respective source file.

At the moment, the default configuration has dedicated entries for autotools input files in the Python section (*.in). My question is if there is mechanism to automatically "ignore" the second suffix in order to apply the correct syntax highlighting. This would prevent four specifications of each file type (normal, backup, autotools input, and autotools output).

Alternative grammars

Is there a recommended way to install grammars not build by default with zee --build?

Is Zee overriding the default cursor?

I had a hard time finding the cursor in Zee and noticed it wasn't using my terminal (eg. macOS Terminal) default cursor, but uses its own. Is this intentional? Is there a way to make it use the terminal cursor?

[Feature Request] Shortcut for Reloading Buffers

When working with Zee, it is useful to have a second terminal to do the Git operations there, for instance committing the latest progress, run tests and so on. Sometimes, one needs to restore a previous state of a single file from the Git history. Then, Zee needs to be restarted -- at least in case that the affected file was edited in an opened window -- in order to mirror the changes there.

As a starting point, I would like to suggest to check whether it would be possible to bind the scanning of the current directory of the focused window to a shortcut. The Midnight Commander (mc) uses [CTRl] + [R] therefore but maybe this binding is already reserved for an earlier feature request.

cargo build not working

Hello Marius,
thanks for your editor. Currently the build seems to be broken. Core/Cargo.toml references a local version of zi:
zi = { version = "0.1.4", path = "../../zi" }
With the tagged version 0.1.4 of zi, it does not build:

error[E0599]: no method named invert found for struct Style in the current scope
--> core\src\components\prompt\buffers.rs:288:65
|
288 | ... .style(self.properties.theme.action.invert())
| ^^^^^^ method not found in Style

error[E0599]: no function or associated item named new found for struct Container in the current scope
--> core\src\editor.rs:578:40
|
578 | let mut container = Container::new(FlexDirection::Row);
| ^^^ function or associated item not found in Container

error[E0599]: no function or associated item named new found for struct Container in the current scope
--> core\src\editor.rs:593:44
|
593 | container = Container::new(*direction);
| ^^^ function or associated item not found in Container

error: aborting due to 3 previous errors

For more information about this error, try rustc --explain E0599.
error: could not compile zee

Regards,
Michael

[Feature Request] Next Release

Since the last release was published on crates.io, several progress was made. Not only important bugs were caught but also useful new features were introduced.

I would like to request a new release with all these changes such that both Cargo and NixOS users (see #89) have access to the latest progress. This does not need to be the complete version 0.4.0 but at least an intermediate release to persist the achieved progress.

Emacs-ish wishlist

Wishlist of a lifelong Emacs user here with spinal-wired muscle memory.

I'm not looking for a complete Emacs clone, but here are some things that I use every minute that doesn't work in Zee which I would love to see added (this list is evolving - expect edits):

Notation: C-x is an Emacs shorthand for Control-x, M-y means Meta-y, S-z means Shift-z, etc.

  • C-u prefix: all commands in Emacs takes an optional numerical argument. C-u has rich semantics, in particular C-u defaults to 4 and every subsequent C-u quadruples this. E.g. C-u C-u C-u Down moves the cursor down 64 lines, C-u C-v moves down four pages etc. (I literally use this multiple times a minute). An explicit value can be set by entering the number, e.g. C-u 1 0 0 Down moves down 100.
  • M-b, M-f, M-p, M-n (equivalent to M-Left, M-Right, M-Up, M-Down). M-b/M-f skips backwords and forwards by "word" (what is considered a word is mode specific). Importantly, forward movements leaves the cursor after the word, backwards leaves it at the start of the word.
  • S-M-b/S-M-f are fabulous for navigating over nested parenthesis/braces/brackets.
  • C-o "opens" a line, that is, (AFAIK) equivalent to Return Left.
  • Undo bindings: C-x u, C-_, C-/
    It's amusing it took me this long to notice. Not sure why there are so many alternatives, but curiously which I use
    depends on the keyboard and terminal (eg. C-/ doesn't work in the macOS terminal for some reason).
  • M-q (fill-papagraph) for formatting text within the settable width, knows about comments and comment blocks.

NB: I might work on adding this myself if this is something you agree should be added.

Unable to compile on MacOS

Error:

โ–ถ [rust/zee] (master โš ) (๐Ÿฆ€ v1.42.0) cargo run  
   Compiling zee-grammar v0.1.0 (/Users/gagan/code/fork/rust/zee/grammar)
error: failed to run custom build command for `zee-grammar v0.1.0 (/Users/gagan/code/fork/rust/zee/grammar)`

Caused by:
  process didn't exit successfully: `/Users/gagan/code/fork/rust/zee/target/debug/build/zee-grammar-2e07b6b7e81bafdf/build-script-build` (exit code: 1)
--- stdout
cargo:rustc-link-lib=static=tree-sitter-css
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("2")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("aes,avx,avx2,bmi1,bmi2,fma,fxsr,lzcnt,pclmulqdq,popcnt,rdrand,rdseed,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave,xsavec,xsaveopt,xsaves")
running: "cc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "languages/tree-sitter-css/src" "-Wall" "-Wextra" "-w" "-o" "/Users/gagan/code/fork/rust/zee/target/debug/build/zee-grammar-0e4aa862b10b9d1e/out/languages/tree-sitter-css/src/parser.o" "-c" "languages/tree-sitter-css/src/parser.c"
running: "cc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "languages/tree-sitter-css/src" "-Wall" "-Wextra" "-w" "-o" "/Users/gagan/code/fork/rust/zee/target/debug/build/zee-grammar-0e4aa862b10b9d1e/out/languages/tree-sitter-css/src/scanner.o" "-c" "languages/tree-sitter-css/src/scanner.c"
cargo:warning=clang: error: no such file or directory: 'languages/tree-sitter-css/src/scanner.c'
cargo:warning=clang: error: no input files
cargo:warning=clang: error: no such file or directory: 'languages/tree-sitter-css/src/parser.c'
cargo:warning=clang: error: no input files
exit code: 1
exit code: 1

--- stderr


error occurred: Command "cc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "languages/tree-sitter-css/src" "-Wall" "-Wextra" "-w" "-o" "/Users/gagan/code/fork/rust/zee/target/debug/build/zee-grammar-0e4aa862b10b9d1e/out/languages/tree-sitter-css/src/parser.o" "-c" "languages/tree-sitter-css/src/parser.c" with args "cc" did not execute successfully (status code exit code: 1).

Rust version:

โ–ถ [~] rustup show        
Default host: x86_64-apple-darwin
rustup home:  /Users/gagan/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.42.0 (b8cedc004 2020-03-09)

MacOS:
Name: macOS Catalina
Version: 10.15.3

Crash on saving

Upon saving a small .md file with C-x C-s, zee crashed with the following:

Internal zee error -- this is a bug, please submit an issue at https://github.com/zee-editor/zee
Thread 'main' panicked at 'byte_slice(): Byte range out of bounds: byte range 0..163, Rope/RopeSlice byte length 160', /home/pluriscient/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.5.0/src/rope.rs:973:23
   0: zee::panicking::save_panic_backtrace_hook
   1: std::panicking::rust_panic_with_hook
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:702:17
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:588:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:138:18
   4: rust_begin_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5
   5: core::panicking::panic_fmt
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14
   6: ropey::rope::Rope::byte_slice
   7: <ComponentT as zi::component::template::Renderable>::view
   8: zi_term::Crossterm<PainterT>::run_event_loop
   9: zee::start_editor
  10: std::panic::catch_unwind
  11: zee::panicking::print_panic_after_unwind
  12: std::sys_common::backtrace::__rust_begin_short_backtrace
  13: std::rt::lang_start::{{closure}}
  14: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:280:13
      std::panicking::try::do_call
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:492:40
      std::panicking::try
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:456:19
      std::panic::catch_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panic.rs:137:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:128:48
      std::panicking::try::do_call
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:492:40
      std::panicking::try
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:456:19
      std::panic::catch_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panic.rs:137:14
      std::rt::lang_start_internal
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:128:20
  15: main
  16: __libc_start_main
  17: _start

[Bug] Visual Width of Tab Characters in Edge Cases

Most languages in the config.ron are configured to indent using spaces, at the moment. When opening a file indented by tabs in a language configured to indent by spaces, the tab characters are displayed with visual width one instead of the configured width. Since other editors apply the configured width onto tabs visually, I would consider this a bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.