Vim.js – JavaScript port of Vim
coolwanglu.github.io
coolwanglu.github.io
Looks like coolwanglu has found a way around this by hacking some kind of async transformation into emscripten. I haven't looked at his code, but I suspect he specially handles known blocking libc calls. My guess is some how storing the set of stack frames when a blocking function is called so that the stack can be unwound to let the js engine continue.
Good stuff.
It did take a little longer than vim to load, but I guess that's expected.
I then gave it a shot in Firefox nightly and it seemed to work really well. This brings me joy.
I don't like to edit forms/documents on the web; it's a constant struggle against my muscle memory. Vim.js could be the start of something that could change that. Well done!
I'll also note that in the past, I've purposefully not upgraded due to serious bugs in the present version of Chrome. (There was a great one a while ago where entire websites — notably Wikipedia — were rendering in the wrong font, for example.)
> a browser that silently auto-updates
While I'll grant that this is true for the majority of users:
1. It requires a user to restart their browser. For me, this usually means the next weekend or Chrome/OS X crash, since during the week I'm usually busy with things other than restarting the browser…
2. Not all OS's auto-update, though this is a very small minority.
I was merely providing feedback / datapoint.
q/
q:
:normal
ctrl-n in insert mode (or any completion like ctrl-x ctrl-l) of course plenty of command line options like virtualedit:
Though it does implement the expression register ( i CTRL-R = ), the regex class \x (among Vim's other rando regex classes), and :set synmaxcol which is pretty nitty gritty.
Can you elaborate and explain what you're missing and what for?
Practical Vim the book is a good place to start. You should be spending as much time learning Vim as using Vim for about the first two years of your Vim usage.
- you haven't answered my question. Like, at all.
- I don't quite like the 'would be better off in an IDE' part.
That said, at this point I'll better see what I can find about these oh-so-essential features and I might even add them to my routine/workflow (so far, I still don't know why though...).
Edit: As expected, the help page doesn't explain why I should care about those. q: and q/ are nothing I ever missed, :normal is weird and I cannot imagine what it is used for. Basically my whole reason to jump on this thread "Okay, now I don't know these. Why are they useful?" is absolutely still relevant. Reading the documentation isn't enough. I .. won't buy a book at this point.
In fact, I think I only type `q:` as a typo when I'm trying to `:q[uit]` :p
Once you get used to using them, you will only use / or : when the search or command you want is absolutely simple and straightforward.
:normal lets you use normal commands at a command line, often used for automation or scripting stuff... so you can do :normal 5j to go down 5 lines.
C-n is just normal complete
But one thing (for whatever it's worth) what makes vim super useful (to me anyway) is the plugins and my vimrc with custom key bindings.
(edit) On second look, it appears you can modify vimrc. Very nice.
Dropping support for operating systems and reformatting the code doesn't make it run faster.
But more importantly, all IO is being ported to libuv, from the blocking calls that are currently being done. This obviously fits Javascript's IO model much better, as you don't have to fake an event loop in Javascript as this port is apparently doing - you just use the event loop the JS implementation provides. After that's done, I'd expect Neovim to work more smoothly as a JS port.
function exportFile(path) { var b = new Blob([FS.readFile(path).buffer], {'type': 'text/plain'}); var u = URL.createObjectURL(b); window.location.href = u; }
And then you can run this to export files: exportFile("/usr/local/share/vim/vimrc");