Skip to content

Releases: efg-technologies/sim

sim 0.2.0

Choose a tag to compare

@nagamine-git nagamine-git released this 21 Oct 00:40

Added

  • <C-w> moves the focus between the text and the tree and leaves the tree open: <C-w>w (and W, p, <C-w>) goes to the other one, <C-w>h or <C-w><Left> to the tree (opening it), <C-w>t to the tree if it is open, <C-w>l, <C-w><Right> or <C-w>b to the text. Ctrl-n is as it was. Insert mode, the command line and the picker keep their Ctrl-w, and the rest of Neovim's <C-w> keys are not taken: sim has no split windows (TREE-2).
  • The tree's folder keys are Neo-tree's: Enter opens a closed folder and closes an open one, C closes the folder (or, on a file, the folder that holds it), z closes them all, and Z opens the folder under the cursor and every folder below it, never a git-ignored folder or a link, at most 200 a press (TREE-4).
  • The bar says colors stopped among its state words, for as long as it is so, for a file whose parse the highlighter gave up after 5 s (it was said once on the status line, where a key ended it) (SYN-3).
  • The changes view: <Space>ge opens the panel with only the files that differ from HEAD, staged and unstaged together and untracked ones too, in their folders. Each file shows its status letter and +n −n from git diff --numstat HEAD (an untracked file its line count) and each folder the sums. Deleted files are listed, and Enter opens HEAD's version of one read-only, as a buffer named HEAD:path whose tab says so; a rename is one row, old → new, with a cut that keeps the new name whole and marks every cut with …. <Space>ge again, or q, goes back to the tree. In sim --plain the key is refused, naming plain mode (DIFF-1 to DIFF-6).
  • The editor's title is a breadcrumb, src › sim.rs › leader_key: the file's path below the root and the section the cursor is in, the nearest Markdown heading or the function, impl, class, struct, trait or module it is inside (found by a few string tests over the lines above it, not a parse). In depth it is the title of the editor's box, in flat it is at the right of the tab bar, and long ones are cut from the left with … (UI-18).
  • The Markdown read view: in a Markdown file every line but the cursor's (and, in Visual mode, the selected ones) is drawn as it reads, in place and in the one pane: the markers of emphasis (**, *, _) and of inline code are not drawn, and tables are aligned by display width (a Japanese cell counts two columns a char, :--, :-: and --: align the text, the delimiter row is ├─┼─┤). Only those markers are ever hidden, never a #, a bracket, a URL or a char of text, and a char shown in another form (^[, <U+202E>) is still the alert's block wherever it is: in a span, a link, a URL, a cell or code (MD-2). A table that does not fit the pane, or has a cell too many, stays raw, whole. <Space>um turns the read view off and on, the choice is remembered in the state directory and the first run is on; sim --plain has none; a click in a read line puts the cursor on the char of the file under the pointer; and the window draws it too (MD-1 to MD-9)
  • sim-gui, a window for sim, in gui/ (a third workspace member, publish = false: it is not on crates.io, Homebrew or the AUR yet, and the sim binary and the sim-editor and sim-editor-core crates do not depend on it). It draws the depth look on the GPU (boxes raised from a floor with soft shadows, a chip for the shown tab, a window that floats over a dimmed page, a char shown in another form as a rounded pill) from the editor's own screen: the keys, the modes, the colors and the jobs are sim's, and the window keeps no rule of its own (GUI-1 to GUI-17). It is built with cargo run -p sim-gui -- <file>; the text is set in the first common coding font the system has (JetBrains Mono, Fira Code, Cascadia Mono, Source Code Pro, Noto Sans Mono, DejaVu Sans Mono, Liberation Mono, Menlo, Monaco, then the system's monospace; SIM_GUI_FONT names another, sim-gui --help lists everything it reads from the environment), the input method works where a key is text, and SIM_GUI_REDUCED_MOTION turns the motion off. It starts through the same function as the terminal, so it is plain as root and as the editor of sudoedit (PLAIN-1: no git, no ripgrep, no filter, no hook), and a hangup or a termination snapshots what is unsaved as in the terminal. Its dependency list is closed and has no webview and nothing that speaks to a network. Not seen on a real display yet.
  • The frame says what the guard did to a repository: where git is not run for the repository's config the tree's box says git not run in the alert's block (in flat, the tree's header does) and the lines of both boxes are the alert's, and where git runs with settings of the repository's own turned off (the monitor, the hooks path, an external diff, a text conversion, a filter) it says n git settings off; a narrow panel gets a shorter form. The status line names the first setting once, and <Space>gi says again why git was not run or which settings were turned off (GIT-5).
  • The lines another process has just written into the open file are lit for 400 ms, the whole text of each in the change's green as a solid block, bold (bold on inverse with no color), and are then marked as they were (UI-19). The core lists the lines a merge marked (App::wrote, one field).
  • A Markdown link whose text looks like an address that its target is not ([https://good.example](https://evil.example), a host that differs, a path that differs from a target with no host, or a javascript:, data: or vbscript: target) has its target drawn on the alert's block in the raw line and in the read view, which hides no bracket, text or URL of a link (MD-10).
  • :tutor: about fifteen minutes of short lessons in a scratch buffer, in the language of LC_ALL, LC_MESSAGES or LANG (English, 日本語, 简体中文, 繁體中文, 한국어, Español, Português, Français, Deutsch, Русский; English for any other), with exercises that are graded as you type: a row [ ] 1.1 … shows ✗ and shows ✓ as soon as the lines under it are right (and ✗ again if you undo). Nine lessons in the editor (movement, typing, deleting and changing, undo, copy and paste, searching, saving and quitting, what sim shows that other editors hide, and the finder, the tree, the looks and <Space>bk, whose exercises are marked done when you do them) and eight with --plain. Nothing typed there writes a file or a snapshot: :w, :wq, :x, ZZ and :w name all say the tutor is a scratch copy, the status line calls it [tutor], and :q! leaves it (TUTOR-1 to TUTOR-4).
  • Markdown callouts (GitHub's alerts): > [!NOTE], [!TIP], [!IMPORTANT], [!WARNING] and [!CAUTION], in any case, on a quote's first line with a body after it, are drawn in the read view as the kind's word (Note) in bold, with GitHub's octicon before it where zi has the icons on; no kind has a hue (the word, always, and the icon tell it; in flat and depth the bar is the primary gray where a plain quote's is the secondary; calm and NO_COLOR have the word in bold), and the line the cursor is on shows [!NOTE] as typed, in bold. Which quotes are callouts was measured against GitHub's renderer (24 forms in a test); other [!KIND]s stay quotes (MD-11).
  • Calm lights a yank too, for the same 150 ms: the text it took is in the gray of a Visual selection (lightness alone, |Lc| >= 15 against the page, SYN-5), and underlined where the selection is (no truecolor, NO_COLOR). It showed nothing; the flash in flat and depth is as it was (UI-13).
  • <Space>bk says again where the version that :w! or :e! gave up was copied, alone on the status line (a path wider than the line is cut from the left, so the file's name stays), as <Space>gi does for the guard (SAFE-7).
  • Every char that is invisible is shown (SAFE-10, SAFE-11): format chars (Cf), unassigned code points, tag characters (the way an instruction is smuggled to a language model), variation selectors (the way code was hidden in packages), Hangul fillers, soft hyphens, word joiners, line separators and the other chars named in the SPEC are drawn as <U+E0041>, in the text, the status line, the messages, the command line and every name and line that comes from a file (the tree, the tabs, the breadcrumb, the search, the picker). A zero-width joiner joins nothing, so it is a form too; emoji sequences, a keycap, the three flags of England, Scotland and Wales, a selector after a pictograph and the icons of a Nerd Font stay as they are. A kanji followed by an ideographic variation selector shows the selector: the price of closing a channel that hid bytes, which falls on Japanese. One table in the core (core/src/core/hidden.tbl, Unicode 18.0.0) says which chars; the editor asks it. Measured against Neovim 0.12.5 in NOTES.
  • Marks (VI-17): ma to mz set a mark in the file; 'a goes to the first non-blank of its line and `a to its place, with an operator (d'a, y`a) and in Visual mode; '' and `` go back to where the cursor was before the last jump (G, gg, /, n, N, *, #, %, a mark, :s, u), as Neovim's do. A mark follows its text through edits and undo (it goes with its line when the line is deleted), and through a change that comes from the disk (DISK-6); a mark that is not set says mark not set: a and nothing moves. :marks lists them on one line. In memory only, one set for each file. core/tests/oracle.rs compares them with Neovim (SIM_ORACLE_MODE=mark).
  • :registers shows each register whole where there is room, and a long one takes what the short ones leave (cut with …).
  • Registers (VI-15): "a to "z hold text and "A to "Z add to it, "" is the unnamed one, "0 the last yank, "1 to "9 the last deletes of a line or more, "- the small deletes, "_ takes anything and holds nothing; the name goes before a command or between its count and it ("ayw, "Ayy, "ap, 2"ayy), in Visual mode too, and . after "1p puts "2p. :registers...
Read more

sim 0.1.0

Choose a tag to compare

@nagamine-git nagamine-git released this 17 Oct 12:23

sim 0.1.0

sim is the next-generation Vim. It shows even what is hidden, it is secure, and it is written from scratch in Rust. The name is short for Secure vIM.

This is the first public release.

Files that other processes rewrite: you read them as fast as possible, fix them, and save them without losing anything. A project's files a few keys away, several of them open at once, and syntax colors that never take the change color's hue.

What makes it different

  • Changes from outside are marked. When a file changes on disk while you edit it, sim merges what doesn't conflict with your edits and marks it, word by word, until you've looked at it; ]c goes to the next mark. Where it does conflict, your text stays, marked, and nothing is written over the file: :w! keeps yours and :e! takes the disk's, and each copies the version it gives up into the state directory first.
  • Saves that can't lose. Saves are atomic (temp file, fsync, rename, directory fsync) and compare-and-swap: if the file changed since you read it, nothing is overwritten. Unsaved changes are snapshotted every second; after a crash, kill -9 or a closed terminal, reopening the file offers them back as one undo step.
  • Hidden things are shown. A character that must not reach the terminal, or that looks like another, is drawn as itself in the alert's block (^X, <U+202E>), and nothing around it can hide it.
  • Readable by measurement. Text is 90 Lc and secondary text 60 Lc (APCA), computed from your terminal's background; the one change color stays distinguishable under protan, deutan and tritan color vision; prose wraps with Japanese kinsoku.
  • Meaning without color. With NO_COLOR set, or on a terminal that cannot do 8 colors, sim writes no color at all: weight, underline and inverse video say what the colors said.
  • Keys your hands already know. The vi grammar, minus vi's accidents: Y yanks to the end of the line, U redoes, search is smartcase, every yank reaches the system clipboard (also through tmux), Ctrl-s saves, q quits, arrows and Home/End work everywhere.

And a place to live in

  • A tree of the project (Ctrl-n) that never reorders, with git status, and the five files you are most likely to open next marked with •.
  • Several files open at once, each one a complete editor with its own undo, snapshots and saves (Tab, Shift-Tab).
  • Find a file (Ctrl-p, or / in the tree) and search the contents of the files as you type (Ctrl-f, with ripgrep if it is on your PATH), in a picker with a preview. A search never writes and never runs code a repository controls.
  • Syntax colors in your terminal's own palette, three looks (zl: calm, flat, depth), a mouse that never edits by itself.
  • sim --plain: the core alone, with no program of its own run (no git, ripgrep, filter or hook). It is what sim is as root and as the editor of sudoedit.
export EDITOR=sim                     # crontab -e, …
git config --global core.editor sim   # git commit (ZZ commits, :cq aborts)
export SUDO_EDITOR='sim --plain'      # sudoedit

Finding the keys

  • A leader and which-key. Space is the leader. Pause after a prefix (Space, g, z, [, ] or an operator) and a small window lists the keys that can come next; keep typing and it is not in the way.
  • :help and F1. Every key and command, fuzzy-filtered, with the longer text in a preview: :help tab finds Tab, Shift-Tab and <Space>bp.
  • Tabs by letter. <Space>bp puts a letter on each tab and the letter shows that file; <Space>bc closes one the same way (a file with changes stays open, as with :q).
  • Hints and counts. The second file you open shows a one-time hint for Tab and Shift-Tab; a search shows [i/n] in the status line while its matches are lit.
  • sim --version prints sim 0.1.0; sim --help prints the usage.

Install

brew install efg-technologies/tap/sim     # Homebrew: builds from source
  • From source: git clone https://github.com/efg-technologies/sim.git && cd sim && cargo install --locked --path sim.
  • The AUR package (sim-editor) and the crates on crates.io (sim-editor, sim-editor-core) follow shortly.

Needs Rust 1.88 or later to build. Runs on Linux and macOS, in any terminal; colors, the kitty keyboard protocol and OSC 52 are used when the terminal offers them (Ghostty, kitty, WezTerm, tmux). git and rg are optional: sim uses them when they are on PATH. sim makes no network connection.

Release asset: sim-0.1.0.tar.gz, the source of tag v0.1.0. sim is distributed as source; the package managers above build it.

What to know

  • "More readable than existing editors" is a hypothesis, not a claim: the benchmark that would test it (time and accuracy to find a change) is not built yet. Flat and depth use red and green for changes and set color vision aside; calm is the look for anyone who cannot tell red from green.
  • Icons need a Nerd Font. They start on in Ghostty, kitty and WezTerm and off elsewhere, with a hint to turn them on (zi).
  • By design sim has no plugins, no config files and no network access; split windows are left to tmux. Its choices live in ~/.local/state/sim (or $XDG_STATE_HOME/sim).
  • Everything sim promises, it promises for every file open in it: without an explicit action, nobody's text is lost.

Why each choice was made, with the research it rests on, is in CONCEPT.md; what sim must do is in SPEC.md, where every requirement has an ID and every ID has tests. The full list of changes is in CHANGELOG.md.

Dual-licensed under MIT or Apache-2.0, at your option.