logoalt Hacker News

Show HN: Fresh – A new terminal editor built in Rust

152 pointsby _sinelaw_yesterday at 2:45 PM112 commentsview on 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


Comments

createaccount99today at 10:17 AM

Would love to see something for diff views (e.g. side-by-side/unified). I mostly program through CLI agents, and so seeing the changes it makes is probably the primary thing I use the editor for, these days.

show 2 replies
fcouryyesterday at 7:28 PM

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...

giancarlostoroyesterday at 6:07 PM

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.

show 2 replies
winterrdogtoday at 10:23 AM

i REALLY love this thing, especially the efficiency and speed (phenomenal!). gonna start using it daily. i guess i will be one of those providing feedback.

Great work!

show 1 reply
dualogyyesterday at 8:53 PM

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 =)

show 1 reply
amadeuspageltoday at 5:07 AM

You should put standard keyboard bindings as a pitch on the website as well. Most people in the market for a terminal editor are probably looking for something that doesn't require them to learn a set of keyboard shortcuts that's entirely different from every other piece of software that they use.

I searched for that desperately until I discovered micro[1].

Here's a quick comparison between micro and fresh:

- Fresh implements more standard keyboard shortcuts, like Ctrl+ArrowLeft and Ctrl+ArrowRight to skip to the next and previous word, Ctrl+Backspace to delete the previous word and Ctrl+Delete to delete the next one.

- Fresh is extensible in typescript, Micro in lua.

- Fresh is able to open the wikidata json dump (1.7T).

- Micro is included in most repos, so if you rent a new VPS you can immidiately dnf install it.

[1]: https://micro-editor.github.io/

dig1yesterday at 8:22 PM

> 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

show 1 reply
20after4yesterday at 10:04 PM

Installed it and out of the box this is the best new TUI editor I've tried, probably ever. There are so many great editors out there but I've never been a fan of modal editing, despite recognizing it's incredible power. My brain just doesn't work that way, yet I'm highly keyboard focused and prefer terminal over gui for most things, especially text.

Great work on this! Very good performance but also a very good UX and you really nailed the discoverability / accessibility - basically everything works intuitively and needs very little explanation - this is something that I can't say about really any other editor I've tried.

This may finally replace nano as my default utility editor, if not my main IDE.

show 1 reply
arkensawyesterday at 6:51 PM

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

show 3 replies
az09mugenyesterday at 9:03 PM

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 !

show 1 reply
capvtoday at 2:05 AM

Dear Santa, this year I don’t need gadgets - all I want is a Borland Turbo Vision–style console text editor with windows, tabs, and syntax highlighting. I promise to be good and keep my code compiling.

show 1 reply
Findecanoryesterday at 6:36 PM

> 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)

show 1 reply
wg0yesterday at 8:50 PM

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.

Sn0wCodertoday at 5:53 AM

Just installed on both pop_os and windows 11. On Linux everything seems to work ok. On Windows 11 the mouse only moves to the start of a line, cannot select text at all click anywhere but the very first part of a line. Every now and then it will select some random word on the line but mostly just column 1. Installed with Cargo if that matters using rustc 1.91.1, looks like 1.88.0 is min supported. On pop the mouse works as expected. Will check it out more when I get time just wanted to give you the heads up.

show 1 reply
user-today at 4:44 AM

Great work, my only nitpick is that when you quit, it tells you that its not gonna save, then its yes to confirm quit. I instinctively wanna type N to quit without saving.

I feel like thats the opposite behavior. For example, I use https://github.com/zyedidia/micro as my main editor in terminal, where it says `Save changes to filename before closing? (y,n,esc)”` when you try to quit.

satvikpendemyesterday at 11:23 PM

All AI generated, not something I can trust.

ivanjermakovtoday at 12:31 AM

Shameless plug: I build a terminal text editor with quite the opposite philosopy. Modal, suckless/assemble it yourself, extremely hackable, plenty fast, written in Zig.

https://github.com/ivanjermakov/hat

esafaktoday at 4:10 AM

1. CI looks unhealthy: https://github.com/sinelaw/fresh/actions/workflows/ci.yml

2. Thank you for running builds on ubuntu 22.04 so it's compatible with it. You might want to compile with cross or zig to support even older operating systems.

simlevesqueyesterday at 6:21 PM

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/

Klasiastertoday at 3:21 AM

Good keybindings, some are missing compared to what normally works, e.g., in the browser text input area or in gnome-text-editor (Ctrl-Shift-Up/Down was one I directly ran into).

I've found https://github.com/gphalkes/tilde to work quite well, it also supports the system clipboard. Nice to see a Rust alternative.

rgloveryesterday at 10:57 PM

I had given up hope on ever finding an editor like this. Just did a little bit of browsing in a current project and WOW. Going to use this for the rest of the day and kick the tires. Well done!

show 1 reply
az09mugenyesterday at 6:52 PM

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.

show 1 reply
qazswxtoday at 10:21 AM

xxxzzx

qazswxtoday at 10:21 AM

cccc

jatinsyesterday at 9:19 PM

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)

show 2 replies
Aeolunyesterday at 11:18 PM

It’s nice that Claude allows you to make things like this just because you want them to exist, right? Making it by hand would be a multi-month project, but it seems to have taken about 3 weeks?

show 1 reply
jlundbergyesterday at 9:32 PM

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!

show 1 reply
yoavmyesterday at 10:22 PM

The multi-cursor experience is the smoothest I've seen in a terminal based editor. Congrats!

zeeeeeebotoday at 1:39 AM

What are Zed's numbers in the performance challenge?

ericbyesterday at 6:13 PM

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?

show 1 reply
AbuAssaryesterday at 8:17 PM

Interesting license choice, would why did you choose version 2 instead of 3?

show 1 reply
aerzenyesterday at 8:00 PM

The look reminds me of Turbo Pascal. Without the bright blue color.

show 1 reply
desireco42yesterday at 11:12 PM

I have to say... I really like it.

I was settled on NVim and VSCode, then I discovered Zed, which is fantastic.

I guess you should not keep your life closed for new experiences. Everybody loves fast and responsive software, what can I say.

Thank you for your work, I will enjoy using it, it isn't for everything but that is how I started with Zed.

show 1 reply
byyoung3yesterday at 7:24 PM

selection is broken on mac eg cntrl+shift+right switches terminal tabs

show 1 reply
Uptrendatoday at 1:59 AM

Would this work over SSH? I have many shells that I use for testing on different OSes and some of them have no working editors at all. I wonder what versions your binary builds will work on.

show 1 reply
gigatexalyesterday at 6:05 PM

love me a new text editor, here for this!

WhereIsTheTruthyesterday at 8:09 PM

400mb executable for a terminal text editor?

Modern developers have lost their mind

show 1 reply