- Rust 100%
| .forgejo/workflows | ||
| benches | ||
| misc | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| README.md | ||
ZTE
About
ZTE is my personal text editor. I daily-drive it, and it fits my needs exactly. It probably doesn't fit yours, although I've made some effort to avoid it being overly obtuse to use.
There are no configuration options: everything is hard-coded. As a rule of thumb, I avoid speculative feature development: unless I feel a feature's lack of presence, I don't add it.
While the code is largely undocumented, I care about simplicity and make an effort to remove redundancy: you may find it a useful resource if you're building your own text editor.
You can learn more about its development here.
Installation
Install Cargo (Rust package manager). Your system package manager probably has it. If not, try here.
sudo cargo install --root / --git https://git.jsbarretto.com/zesterer/zte.git
You can run this command again to update your installation. sudo cargo remove zte will uninstall.
Features
- Buffers
- Buffer switching
- Prompt
- Cursor selection
- Basic cursor movement
- Multiple panes
- Pane creation/deletion
- Open
- Save
- Save as
- Move
- Find
- Find in selection
- File watching
- Search in buffer switcher
- Syntax highlighting
- Project search (including file path search)
- Regex search
- Auto-indent (and related features)
- Undo/redo
- Ability to resize panes
- Terminal buffers
- Tabs
- Mouse support
- Delimiter matching
- Multi-cursor mode
Todo
- Git integration
- LSP integration
Issues to fix
- Return should only complete block if matching delim has different ident
- URLs in terminal panes should get automatically detected
- Implement elastic tabstops
- Separate
Statefrom visual layout, allowing for variable-width chars, graphemes, collapsing of functions, wrapping, etc.
- Separate
- Add status bar
- Current time?
- Buffer switcher should show preview
- Make matching delims easier to see
Keybindings
File & buffer manipulation
Buffers represent open files and are tracked independently of view panes.
Ctrl + n = New buffer
Ctrl + o = Open buffer
Ctrl + s = Save buffer
Ctrl + Shift + s = Save buffer as
Ctrl + m = Move buffer
Ctrl + b = Switch to buffer
Ctrl + q = Close buffer
Ctrl + t = New terminal pane (WIP)
Search and command prompt
Searching occurs across the repository that the current file resides in.
The command prompt provides access to more fine-grained commands.
Ctrl + Shift + o = Path search
Ctrl + Shift + f = Text search
Alt + Return = Open command prompt
Navigation & panes
Escape = Cancel current task or close editor
Alt + w = Select pane above
Alt + a = Select pane left
Alt + s = Select pane down
Alt + b = Select pane right
Alt + Shift + w = Create pane above
Alt + Shift + a = Create pane left
Alt + Shift + s = Create pane down
Alt + Shift + d = Create pane right
Alt + PageUp = Select tab above
Alt + PageDown = Select tab below
Alt + Shift + PageUp = Create tab above
Alt + Shift + PageDown = Create tab below
Alt + q = Close current pane
Alt + i = Grow current pane vertically
Alt + k = Shrink current pane vertically
Alt + l = Grow current pane horizontally
Alt + j = Shrink current pane horizontally
Editing
'Standard' non-modal editing controls apply, for the most-part
The mouse can be used to select and drag as one might expect
Ctrl + l = Go to line
Ctrl + Space = Select containing block
Ctrl + a = Select all
Ctrl + f = Open finder
PageUp = Scroll upward
PageDown = Scroll downward
Home = Scroll to top
End = Scroll to bottom
Ctrl + z = Undo
Ctrl + y = Redo
Ctrl + c = Copy
Ctrl + x = Cut
Ctrl + v = Paste
Ctrl + / = Comment line or selection
Ctrl + d = Duplicate line or selection
Multi-cursor
Multiple cursors are supported. For the most part, all controls work as normal, except that actions are replicated across all of the cursors. A small number of actions are not compatible with multi-cursor and will cause the multi-cursor session to be ended.
Every multi-cursor session has a 'primary' cursor. Usually, this is the most recently created or selected cursor.
When combined with the finder, this facilitates find-and-replace: simply find desired elements, select all the results as cursors, and type whatever replacement text is desired.
Alt + Click = Create a new cursor
Alt + Return = Select all finder results as cursors
Search regex
When searching (find, project search, etc.), a non-standard regex is supported in which:
- Any whitespace matches any whitespace
@(<regex>)where<regex>is a regex group@[<regex>]where<regex>is a regex set@[^<regex>]where<regex>is a regex negative set@identmatches any C-like identifier
For example, I @ident foo@[dl] will match I eat the food and I pity the fool.
Lines of code
As an experiment, I'm limiting zte to just 10,000 lines of Rust code (not including dependencies). I want to see what effect this might have on code quality.