Looks like this is mostly running interpreted "Emterpreter" byte code (the .wasm blob is about 52 KByte, but there's a 1.9MBytes emterpretify.data file, which (I guess from the size) contains the bulk of the logic. If this is indeed true it doesn't really use WebAssembly's strengths, since only the bytecode interpreter is running in WebAssembly, while vim itself is running interpreted.
Emterpreter was added to emscripten to workaround the problem in the browser runtime that you can't execute long-running blocking functions from within the browser loop. Emterpreter essentially allows to yield and continue from the middle of C code, however it's intended to only run as little code as possible like this (for instance only in the outer event-loop of an application), and call into asm.js or wasm code, where the actual work should happen.
Again, whether this vim demo works like this is speculation on my side, based on the relative sizes of the .wasm and emterpretify.data file sizes :)
Don’t be silly. There will soon be 3 poorly-written plug-ins that will give you almost the exit functionality you want, all with overlapping yet incomplete features.
It's a little buggy, but being both a vim and web fan I like the idea.
With that said, does anyone have insight in how porting something like this works? Are there terminal emulator libraries already for WASM or did they need to make their own?
Vim is an interesting case because unlike terminal programs that run in sequence, vim needs to redraw any part of the screen at any time. It strikes me as being more complicated.
I noticed there are some terminal libraries in there but they have modifications and I don't know enough to know if those are standard or the author needed to invent something.
ok, that's pretty cool! Some things are a bit slow like character repeat is a bit wonky, help doesn't seem to work... but otherwise, seems like vim to me
Well if nothing else Vim is very nice for modifying text strings. So for example I might be writing some markdown for a Stack Overflow answer / GitHub issue, if I can quickly open a tab in my browser format all the text nicely - e.g. indenting all the code 4 spaces in for SO and then yank and paste it back into SO. You don't ever need to leave the context of the browser and you get some added text formatting properties.
It's probably not a huge benefit, but in the same way you can often SSH into somewhere open up Vim make a change and then leave, I can see it being a nice 'clipboard' for my web text. It's not a lot different just to switching to Vim running on your desktop, but I often keep Vim in a separate virtual desktop. I could then also potentially optimise by browser Vim for formatting Markdown / JSON.
It also shows some of the lovely flexibility of Vim.
That doesn't give you a nice scratch pad / clipboard though.
Plus the browser bindings are never quite right. Although this implementation is a bit buggy, it's actual Vim. So where as it might not have things like multiple buffers, just being able to edit a single buffer in a familiar environment is a really nice feature to have.
I'm certainly going to give this a shot when I next add an answer to SO.
Emterpreter was added to emscripten to workaround the problem in the browser runtime that you can't execute long-running blocking functions from within the browser loop. Emterpreter essentially allows to yield and continue from the middle of C code, however it's intended to only run as little code as possible like this (for instance only in the outer event-loop of an application), and call into asm.js or wasm code, where the actual work should happen.
Again, whether this vim demo works like this is speculation on my side, based on the relative sizes of the .wasm and emterpretify.data file sizes :)