Show HN: Fresh – A new terminal editor built in Rust
63 points
6 hours ago
| 18 comments
| sinelaw.github.io
| HN
I built Fresh to challenge the status quo that terminal editing must require a steep learning curve or endless configuration. My goal was to create a fast, resource-efficient TUI editor with the usability and features of a modern GUI editor (like a command palette, mouse support, and LSP integration).

Core Philosophy:

- Ease-of-Use: Fundamentally non-modal. Prioritizes standard keybindings and a minimal learning curve.

- Efficiency: Uses a lazy-loading piece tree to avoid loading huge files into RAM - reads only what's needed for user interactions. Coded in Rust.

- Extensibility: Uses TypeScript (via Deno) for plugins, making it accessible to a large developer base.

The Performance Challenge:

I focused on resource consumption and speed with large file support as a core feature. I did a quick benchmark loading a 2GB log file with ANSI color codes. Here is the comparison against other popular editors:

  - Fresh:   Load Time: *~600ms*     | Memory: *~36 MB*
  - Neovim:  Load Time: ~6.5 seconds | Memory: ~2 GB
  - Emacs:   Load Time: ~10 seconds  | Memory: ~2 GB
  - VS Code: Load Time: ~20 seconds  | Memory: OOM Killed (~4.3 GB available)
(Only Fresh rendered the ansi colors.)

Development process:

I embraced Claude Code and made an effort to get good mileage out of it. I gave it strong specific directions, especially in architecture / code structure / UX-sensitive areas. It required constant supervision and re-alignment, especially in the performance critical areas. Added very extensive tests (compared to my normal standards) to keep it aligned as the code grows. Especially, focused on end-to-end testing where I could easily enforce a specific behavior or user flow.

Fresh is an open-source project (GPL-2) seeking early adopters. You're welcome to send feedback, feature requests, and bug reports.

Website: https://sinelaw.github.io/fresh/

GitHub Repository: https://github.com/sinelaw/fresh

jlundberg
52 seconds ago
[-]
Looking forward to giving this a try, especially on my first gen Raspberry Pi! :)

What are the reasons behind going with GPL-2 instead of a more permissive license like MIT or 0BSD?

You will probably at minimum build some neat helper functions and maximum code reuse is IMHO the best thing for the world.

I would for instance be curious on the ANSI routines but hesitate to invest mental energy when the code has limitations on usage.

Lastly cool to see new open source programs being built with heavy help from a code generation model. Inspiring!

reply
dualogy
39 minutes ago
[-]
Goood stuff!

One of my long-standing "would make if I had the time and perseverance" themes has been a terminal text editor that's hugely VSCode-like + compatible, so always glad to hear anyone going anywhere near that, and hence I perked up from these:

> Prioritizes standard keybindings and a minimal learning curve.

> Extensibility: Uses TypeScript (via Deno) for plugins, making it accessible to a large developer base.

Because where you are now with Fresh, you're probably really not far from supporting say `settings.json`, `launch.json`, `tasks.json`, `keybindings.json`, `.tmTheme`s and theme `.json`s, and indeed bringing up a VSCode-API-implementing "extension host" that can load up and run/host most `.vsix`es. Now, being terminal-based you'd skip over certain feature subsets such as webviews, custom (non-text) editors and the like... and might postpone Notebooks and such fancies initially, but:

Consider! 1000s of high-value, capable, tech-specific dev extensions out there, all readily supported by your just-spawned new editor. Doesn't that sound pretty exciting?

After all, there's a huge subset of VSCode fans who'd always switch in a heartbeat to a just-simply-non-Electron version (whether native or terminal) of the very same feature-scape & extensions & UI dev experience if only it was made and to max compatibility (and MS won't ever do so).

All that's missing (from screenshot glance) is the other sidebars & panels in addition to File Explorer =)

Will be putting your Fresh on my Github Watch list, but then again, I never really read the GH feed anyway.. but maybe I'll remember to check back in every quarter or so =)

reply
_sinelaw_
17 minutes ago
[-]
I've been mulling over vscode extension compatibility... There is a challenge there, because the API surface is non-trivial and some of it is "web-ish". I wouldn't want people to be disappointed if 60% of the plugins they try to use don't really work properly.

Also, there are nuances like VSCode exposing APIs that force the entire file to be in-memory (which is how VSCode works), this is fine but in my editor I'm trying to get extensions to work well even if the file is huge (encouraging incremental / partial stuff).

But yes, it's a very compelling vision... and part of the reason I chose TypeScript.

Thanks for the input :)

reply
fcoury
2 hours ago
[-]
Shameless plug: I did a series a couple years back, before AI was this huge, about writing a Vim-like editor in Rust, in case you want to play with it in the future:

https://www.youtube.com/playlist?list=PL9KpW-9Hl_het1V3_dLhG...

reply
jatins
13 minutes ago
[-]
I love a new editor as much as the next guy but has there been any real new/novel features in text editors over last 10 years?

I feel like sublime text got most of it right and every editor since then has been a reskin of the same (just written in a different stack)

reply
benrutter
5 minutes ago
[-]
Language server protocol is a huge deal! Without it, I think we'd still see a lot more JetBrains style language bespoke IDE use and a lot less VSCode style text editor + plugin combos.

Since the original post was about a TUI editor, its worth mentioning Helix which supports most modern language out the box. That's amazing and wouldn't have been possible 10 years ago.

reply
_sinelaw_
3 minutes ago
[-]
Sublime, Atom, VSCode, and now Zed are all GUI-based. That's not bad - but I prefer the terminal (and I find tmux + ssh very convenient). I guess it's a matter of personal taste.

For terminal based, there are also many options but not so much in the direction of "VSCode style". They're mostly focused on being "vi-style". And also the huge file support isn't as good in any of the others that I've tried.

reply
az09mugen
29 minutes ago
[-]
I just tested it and I must say congrats. I really enjoy the command palette, the open file menu and the multi cursor. It's well thought, really intuitive so far and I definitively will use it regularly (more once I setup the LSP).

Keep up the good work !

reply
_sinelaw_
21 minutes ago
[-]
Thanks and if you encounter any issues (even minor annoyances) let me know (e.g. open a github issue), I want the experience to be smooth
reply
giancarlostoro
3 hours ago
[-]
I'm a little annoyed that for a Rust based tool the recommended installation command is to use npm. Why? Is Cargo not good enough? Cargo seems exceptionally well to me.
reply
Barathkanna
2 hours ago
[-]
I get the frustration, but I think the npm option actually makes sense here. A lot of users who’d benefit from a fast Rust tool aren’t Rust developers and won’t have Cargo installed. Shipping it through npm lowers the barrier while still giving everyone the performance benefits. It’s not a knock on Cargo, just a way to make the tool more accessible.
reply
ljm
2 hours ago
[-]
Given the fairly shoddy security story with NPM, I genuinely don't understand the hesitation to publish a binary and have a README instruction to curl/wget it into `/usr/local/bin` or `~/.local/bin`. If it's going through NPM that publishing step has to be done already, unless the NPM build is pulling down rust to compile it all as a native extension.

Eventually it'd wangle it's way into homebrew or the unstable branch of another package registry.

But that's me, because I really dislike installing binaries via a language's package manager, because they don't get updated unless I frequently run the upgrade commands for each package manager.

reply
_sinelaw_
2 hours ago
[-]
That (security ) is something I also worry about. I'd like to get off npm if only for this reason. It's a hack to get started.

The other thing it gives you is the ability to easily upgrade and uninstall so just a script to copy stuff is not on par.

reply
ljm
2 hours ago
[-]
Thing is… who is regularly running `npm update` or `cargo update` to keep local software up to date?

I wouldn’t, because I might be in a repo and it starts upgrading all my local dependencies, and I’m not gonna add a text editor as a dev dependency. I’ll happily take the binary, or a tar.gz with the binary in it, though.

(Btw I love how it’s following the old DOS aesthetic)

reply
_sinelaw_
1 hour ago
[-]
The npm distribution here is just the binary, you run npm install again and it upgrades to the latest binary. That's convenient
reply
_sinelaw_
3 hours ago
[-]
I did it because not everybody has cargo installed. I'm using cargo-dist to create this npm package.
reply
giancarlostoro
2 hours ago
[-]
I've been wanting a generic package manager for a while that is cross-platform. I wonder how one could find funding for such a project. Thinking about users from various OS' installing tools and software from your niche package manager, yeah that bad boy is going to grind to a halt if you have no key funding.
reply
venturecruelty
1 hour ago
[-]
Artifactory exists. It's not hard to store packages and metadata somewhere.
reply
LoganDark
53 minutes ago
[-]
Is there a way to install it with cargo instead? I won't install npm on my machine just to install a Rust package
reply
_sinelaw_
39 minutes ago
[-]
Sure, cargo install fresh-editor
reply
baq
2 hours ago
[-]
consider wget or curl if possible (why not if npm was...)
reply
arkensaw
2 hours ago
[-]
I tried it, I like it a lot, but I did find an issue straight away.

I'm on MacOS and I have remapped the fn and command keys so it can be more like Windows (I can't undo 20+ years of muscle memory, and also I just don't wanna)

Anyway, Fresh seems to ignore the remapping - it's back to the command key for copy/paste and the command palette.

Is there a way to access the dropdown menus by keyboard? I can see F underlined for File but no modifier key seems to make it happen

reply
_sinelaw_
2 hours ago
[-]
I'll need to look into this, not sure what remapping does to the incoming key events.

Also I'm already working on a ui for customizing the key bindings so you could do whatever you wanted. (Currently managed by undocumented json)

Thanks for reporting!

reply
dig1
1 hour ago
[-]
> I did a quick benchmark loading a 2GB log file with ANSI color codes... Emacs: Load Time: ~10 seconds | Memory: ~2 GB

Now try opening it in Emacs with vlf [1] ;) Great work overall — looking forward to seeing further development!

[1] https://elpa.gnu.org/packages/vlf.html

reply
wg0
43 minutes ago
[-]
Haven't tried it but I'm pretty sure this editor is going to be very popular very soon.

Because configuring an editor that comes with different plug-in systems in a third programming language is a lot of hassle for people who are too focused at getting the job done and don't want to be distracted with a whole another configuration framework in yet another programming language.

reply
Findecanor
2 hours ago
[-]
> Efficiency: Uses a lazy-loading piece tree to avoid loading huge files into RAM

I once started writing a text editor on Linux, and first went down a similar route: a piece table over a mmap()'d file. But I abandoned using mmap, because Linux file systems typically don't have mandatory locking enabled, so you can't be sure that the file data won't be modified by another program.

(Then I got bogged down in Unicode handling... so 95% of the code became just about that, and I tired of it)

reply
_sinelaw_
2 hours ago
[-]
I considered using mmap to help manage the caching but what if your file is hosted on S3 or whatever? (Something I'm planning to support eventually)

So I opted for explicit management of chunks, also gives me more control and consistent cross platform behavior.

reply
simlevesque
3 hours ago
[-]
I hate to be that guy, but did you know about Fresh, Deno's official frontend framework ? [1] If your app wasn't using Deno for extensibility it wouldn't be such a problem but since it is, I think it's gonna make searching for both harder.

[1] https://fresh.deno.dev/

reply
AbuAssar
1 hour ago
[-]
Interesting license choice, would why did you choose version 2 instead of 3?
reply
_sinelaw_
23 minutes ago
[-]
Honestly it reflects on my, uh, experience - I still think of GPLv3 as a "new" license.

I don't have a particular reason. Maybe I should switch.

reply
az09mugen
2 hours ago
[-]
Thanks for this cool project ! I was desperate to find more modern terminal editors with CUA mode. There is micro which is already good, but I wanted something more and hope your editor will fill that space.
reply
aerzen
1 hour ago
[-]
The look reminds me of Turbo Pascal. Without the bright blue color.
reply
_sinelaw_
1 hour ago
[-]
reply
ericb
3 hours ago
[-]
I took a look--it seems like you can pass a path on the command-line to open to. Can you pass a line number, also?
reply
_sinelaw_
3 hours ago
[-]
No, but that's a good idea, I'll add that
reply
ericb
3 hours ago
[-]
Also--cool editor!
reply
byyoung3
2 hours ago
[-]
selection is broken on mac eg cntrl+shift+right switches terminal tabs
reply
gigatexal
3 hours ago
[-]
love me a new text editor, here for this!
reply
WhereIsTheTruth
1 hour ago
[-]
400mb executable for a terminal text editor?

Modern developers have lost their mind

reply
wg0
40 minutes ago
[-]
Is it 400mb? Could be V8 for plugins.
reply
_sinelaw_
29 minutes ago
[-]
Thanks for reminding me. Unfortunately yes, it's because of v8 (for Deno).

For extensions, the choice was either TypeScript (and get this bloat) or go with Lua and a much smaller binary (but less popular language).

But - I just realized stripping it brings it down to 76MB so I guess that's ok! Will push a commit :)

reply
wg0
7 minutes ago
[-]
Great! Just wondering maybe Bun (different JS engine) could do the job for plugins.
reply
_sinelaw_
43 seconds ago
[-]
Anthropic Bun? :) I didn't realize it was an engine as well. I can take a look but we should wait and see where the acquisition takes it
reply