VIM In The Browser - The Magic of WASM
Written by Ian Elliot   
Wednesday, 18 July 2018

No this is not some JavaScript mock-up of VIM, this really is the original real VIM compiled to WASM and then loaded into a browser. It doesn't get more authentic or crazy than this. It is the shape of things to come.

Who knows, there may be some fatal flaw in the WASM project that means its potential will never be realized, but it is important to understand that perhaps we are on the verge of a sea change.

WASM - Web ASseMbly is a fairly low level representation of a program that consists of a set of syntax trees that lend themselves to be executed either by direct interpretation, by a VM, or by being compiled to native code. The idea is that the representation of the code should allow fast execution with minimal need for further syntactic analysis.

The idea was originally presented as a way to make JavaScript more acceptable. It has long been said that JavaScript is the assembly language of the web, and WASM is designed to be just that. However, it doesn't have to target just the browser. In the WASM standard the browser is just one possibility. Yes, this is another chance at the "write once, run everywhere" holy grail.

At the moment all of the latest versions of the most used browsers support WASM. What this means is that if you take a compiler like LLVM C and convert its intermediate bit code into WASM, then you can run a C program on a browser, or anywhere WASM is accepted.

Of course, things aren't quite as easy because a program like VIM assumes that there is an operating system and other libraries. You still have to do some work.

Developer rhysd on GiHub has a repo where you can avoid the work and just download and run it. There is even a link that will just open VIM in your browser - I hope you remember the command to get out of it.

The project does highlight some of the difficulties in working with WASM and one in particular might be the problem that means that its success is not a certain as its supporters would have us believe.

The problem is that you have to build the I/O and other OS services for the program you are converting using JavaScript. It was also necessary to comment out many features that could not be supported.

 vimwasm

 

Yes it is impressive that you can run VIM in a browser, but it is mainly impressive because of the amount of work that has gone into it. In a paradoxical way, it would be more impressive if it was easy.

The big problem with WASM at the moment is that compiling a range of languages into a common executable format isn't really what we want. Both .NET and Java do exactly this and they haven't managed to take over the world completely. The real task for WASM is that it has to provide all of the non-language features that are involved in an execution environment. In this sense the WASM project is more like WINE - the provision of a Windows environment under Linux. The development of WINE has proceeded over the years so that you can run more and more Windows apps, but there is always something more to do and always an app that breaks the emulation.

WASM has to get easier to use and for this to happen the development input required is huge. It isn't enough to simply create browsers that can execute the code.

Now all I can ask for is EMACs in the browser. and then we can start the whole EMACs v VIM argument over again, but this time with a side order of which browser is best. Somehow I don't think this scenario would attract the right sort of programmer.

 

VIMicon

More Information

https://github.com/rhysd/vim.wasm

Related Articles

One Million Programmers Want To Escape Vim

Which Code Editor Do Devs Prefer? 

//No Comment - Vim And EMACs 

Survey Reveals Developer Preferences 

Practical Vim, 2nd Ed (Pragmatic Bookshelf) 

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


Edgeless Systems Announces Continuum AI
14/03/2024

Edgeless Systems has announced the launch of Continuum, a  security solution that provides cloud-based "Confidential AI" services and enables sharing of sensitive data with chatbots such as ChatG [ ... ]



Open Source Key To Expansion of IoT & Edge
13/03/2024

According to the 2023 Eclipse IoT & Edge Commercial Adoption Survey Report, last year saw a surge of IoT adoption among commercial organizations across a wide range of industries. Open source [ ... ]


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Wednesday, 18 July 2018 )