With web assembly on the horizon, can a build target for emscripten be added?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
Need more context. What is that for and what has this to do with an editor?
@chrisbra Not OP, but I also want this. Also a disclaimer: I don't know much about this codebase other than the fact that it seems to consists mainly of C and VimScript. I assume the VimScript uses a runtime compiled from some of the C source. Anyway, if built for WebAssembly, it would be a much more performant way to use Vim in the browser than what has been done up until now, i.e. JavaScript ports of Vim.
There are plenty of use cases for running Vim in a browser "natively", but I'll limit this list to the ones that I personally want:
@Immortalin I my previous comment, I was going use Vim.js as an example of a port of Vim to JavaScript because, well, that's what the author says it is. However, I then noticed that the repo looked pretty familiar—it's basically a fork of Vim that builds it using Emscripten, but I'm assuming it targets asm.js (based on the fact that it was last updated in 2015).
Basically Vim.js targets asm.js via Emscripten, and is rendering to a <canvas/> element.
I'm betting that repo presents the easiest path to having a POC of building Vim for WebAssembly.
is this simply a way of "cross-compiling" or do we actually need changes to the codebase? I am sure, PRs for the first one will be welcomed, while actually changing the codebase will probably be a big task.
It is a way of cross-compiling by some simple wrapper code might have to be written to allow interop with other browser entities e.g. textboxes
IIRC the problem with Vim.js is that keyboard input in Javascript is non-blocking. From my understanding, coolwanglu had to make significant changes to get input working properly. It wasn't as simple as only compiling with Emscripten.
It would be cool to target wasm in the future. That would be a lot more performant than asm.js.
Any latest news regarding to compile WASM (from Clang) using emscripten inside Vim?
I don't think this is currently being actively being developed or even researched. So unless somebody steps up and provides some PRs, you should not expect any progress here in the foreseeable future.
@chrisbra running :!emcc xy.c -s WASM=1 -O3 -o xy.js inside Vim, it is possible to compile, just need more "easy way" to done that, and seeing the outcome result with emrun --no_browser --no_emrun_detect --port 8080 . `` need to be like preview markdown to have an external trigger to handle the viewhtml , once the emrun ``` command are executed .
wait a second, I understood the ticket to be to have an emscript target for Vim, e.g. provide a make target to have vim compiled as webscript. Now you seem to be talking about providing a general way to compile some C file as webscript? That would be better by delegated to a plugin. That should already be possible today without any changes.
@chrisbra my bad, i need to explain further, the "easy way" i mean is using Vim to compiled it as webscript.
sorry, didn explain that. =.=
So you want Vim to be compiled as WebScript? You already seem to know how this works in general.
Now it's your chance to step up, contribute something to a well known open source project and create a PR with the required changes :)
@chrisbra, i'm trying it now =.= but still hanging here and there, still need a initial file from WASM, so that Vim will know, this C are for webscript, instead that Vim will treat it as normal C.
Have a look at https://github.com/rhysd/vim.wasm