
Vim.js - JavaScript port of Vim - sebg
http://coolwanglu.github.io/vim.js/web/vim.html
======
mqzaidi
Rule 34 for software: If it exists, there IS a javascript port of it.

~~~
tlrobinson
That would be Atwood's Law: any application that can be written in JavaScript,
will eventually be written in JavaScript.

[http://www.codinghorror.com/blog/2007/07/the-principle-of-
le...](http://www.codinghorror.com/blog/2007/07/the-principle-of-least-
power.html)

And tlrobinson's Law (or corollary?): Any submission to Hacker News about a
novel JavaScript program will contain a comment referencing Atwood's Law.

[https://twitter.com/tlrobinson/status/395636386671235072](https://twitter.com/tlrobinson/status/395636386671235072)

~~~
Patient0
PatientZero's law: Any submission to Hacker News about a novel Java script
program containing a reference to Atwood's law will contain a reference to
tlrobinson's law.

;-)

~~~
alxndr
...authored by tlrobinson?

------
saosebastiao
I'm normally unimpressed by applications ported to javascript. However, this
actually has me excited. I would love to be able to edit all my Dropbox text
files with a web interface. If anyone here works for Dropbox, I beg you to
integrate this!

~~~
suprjami
[http://dillinger.io/](http://dillinger.io/) you already can

~~~
tunnuz
There is also [http://stackedit.io](http://stackedit.io)

------
bilalq
Really cool! It even supported doing things like:

    
    
        inoremap jj <Esc>`^
    

Backspace ended up triggering the browser's back action though. Other than
that, this is really nice.

Edit: After looking at the source, this seems to make use of emscripten to
reuse Vim's existing source code. This really makes me wonder what other cool
things we can bring over to the client side.

~~~
chrismorgan
… There are still browsers that use backspace for navigation?

(I'm a little surprised by this because I've seen _so_ many complaints about
it leading to data loss.)

~~~
markburns
_I_ use backspace for navigation. What's the alternative? Use a mouse?

~~~
sanxiyn
Alt-Left.

~~~
roryokane
On Mac OS X, the standard shortcut is Command-[ instead (and Command-] is
Forward).

~~~
saraid216
I generally use three fingers swipe to the left.

~~~
Tyr42
As do I. Actually, if I have a mouse, I tend to right click, then hit back,
it's the first option.

------
IgorPartola
This... Plus Gmail... Man that's fantastic. I have sent an embarrassing number
of emails that end with :wq.

Once you try Vim, it's really hard to go back. I also tried using mutt instead
of GMail, and while it gets me 90% of the way there, the lack of graphical
preview of attachments and things like filters and HelloSign make GMails web
interface more useful.

~~~
squigs25
Who uses :wq when you can use :x?

~~~
IgorPartola
I save very often using :w. When I want to save and exit my brain is now hard-
wired to do :wq. It would probably take a year for me to train myself to use
:x, which is arguably just as slow since I have to reach down with my ring
finger instead of up. Not saying anyone should switch, just that it would be
hard for me to do so.

------
gnur
All the three letter motions I tried don't work. Without them this is more vi
then vim. caw ci" ca( all don't work.

~~~
justinmk
It is built with the compiler flag: --with-features=tiny.

------
imslavko
For Vimium users: don't forget to enter the insert mode in your browser first
;)

------
xcyu
This is pretty cool. Backspace not working for me though in Chrome.

~~~
bromagosa
Same here, Chrome on Debian.

Backspace and ESC not working, so after I enter a mode I'm stuck in it
forever.

------
Aqueous
did you port ncurses using emscripten? This could enable bringing a large
portion of GNU over to the browser as a cloud-based app. Stallman's nightmare,
in other words.

------
jay-anderson
It works amazingly well. However don't split windows then use ctrl-w j to
switch. The browser captures ctrl-w first and closes the tab. Other ctrl-*
combinations don't work probably for similar reasons.

------
marijn
See also
[http://codemirror.net/demo/vim.html](http://codemirror.net/demo/vim.html)
(though that's only the editor component, not a whole vim implementation)

~~~
dddddannyyyyy
this is not vim, this is some incomplete bindings implementation.

------
tikwidd
Who wants to make a javascript emacs? you could call it emscriptenmacs..

~~~
vidarh
ymacs (Fabrice Bellards Emacs "clone") is installed in jslinux.

~~~
cristiantincu
Ymacs is written by Mihai Bazon. It has nothing to do with Bellard.
[http://www.ymacs.org/](http://www.ymacs.org/)

Edit: And it’s _written_ in JS, not ported.

------
JasonFruit
I tried it, and now I'm confused and angry! Seems right to me.

------
volaski
Cool. Now go build NERDTree and Ctrl-P and come back. Then I will use it

~~~
jbeja
You still use those?

------
lorenzfx
I really hope someone will patch it into the IPython notebook (or at least
enable the codemirror vim keybindings). If I can find the time to learn some
javascript I'll give it a go myself.

------
cauliturtle
nice but `backspace` then I returned to >
[https://news.ycombinator.com/item?id=6899072](https://news.ycombinator.com/item?id=6899072)

~~~
pyramation
same here, cool idea though.

------
siddboots
Can anyone think of a sane way to make this integrate with github?

~~~
lauriswtf
I found a solution for this - [http://lauris.h-s.io/2013/12/13/github-vim-
editor/](http://lauris.h-s.io/2013/12/13/github-vim-editor/)

~~~
siddboots
Thanks! I was trying to get my head around why vim mode wasn't working. This
works great.

------
ra3
Lots of comments seem to expect some further web integration with various
services but this looks like more of a prototype/proof-of-concept using
emscripten.

Cool nonetheless.

------
fhd2
While this is impressive, I find it surprisingly slow compared to much more
demanding applications with bigger code bases compiled via Emscripten. Any
ideas why?

~~~
justinmk
Well, I don't know what you mean by slow, but it could be the use of
setTimeout() every 10ms to simulate[1] Vim's synchronous busy-wait is
affecting responsiveness.

Lu mentioned[2] on vim_dev that it was necessary to write a hack for this
portion.

[1]
[https://github.com/coolwanglu/vim.js/blob/master/web/vim_lib...](https://github.com/coolwanglu/vim.js/blob/master/web/vim_lib.js#L478)

[2]
[https://groups.google.com/forum/#!topic/vim_dev/AQTHbUHijgg](https://groups.google.com/forum/#!topic/vim_dev/AQTHbUHijgg)

~~~
ehsanu1
Yeah, I hit this same road-block when trying to port vim to JS and gave up
because it didn't seem worth it after that. If only vim ran a regular event
loop, it would have been such an easy port, compared to what they had to do
here. When figuring out how I could overcome it, I remember reading accounts
of KDE developers trying to embed vim into their widgets and failing over and
over. In the end, there was a solution to "embed" vim with some special IPC
the netbeans IDE developers put into vim, but you had to run vim as a separate
process for that to work - which is not possible on the web as it stands
today. The numerous synchronous busy-wait loops in vim killed all approaches I
had considered, so kudos to these guys for figuring out a way, even if it's
slow.

~~~
justinmk
There's an event loop patch on vim_dev being played with. Maybe in the next 12
months we will see some action with that approach or the other "timers"
approach submitted (and ignored by Bram) by the floobits devs.

------
pablovidal85
Very slow (unusable) on a MacBook Air 1.4GHz 4GB RAM using Chromium
30.0.1589.0 (215899). I suppose it's the price of using an emscripten port.

------
toblender
OMG you made my day, split window and window navigation, tabbing is all
there!!!

Just need we need now is syntax highlighting and color torte :P

Fantastic work!

------
Xelom
Waiting for os.js, javascript port of X operating system. And js.js,
javascript port of javascript. Javascripteption anyone?

~~~
vidarh
There are already several PC emulators in JS, and there are at least two
Javascript interpreters in JS:

This one is Spidermonkey compiled with Emscripten:
[https://github.com/jterrace/js.js/](https://github.com/jterrace/js.js/)

And this one is a test-bed for new JS language features (or at least meant to
be - don't know how far along it is):
[https://github.com/mozilla/narcissus](https://github.com/mozilla/narcissus)

------
waitingkuo
Wow, I can use hjkl to move my cursor !!!

------
yepguy
Kinda cool as a demo, but too many vim shortcuts are hijacked by the browser
for this to be useful to me.

------
jihip
Very cool! I know code mirror had vim mode but this. This is something way
more awesome.

------
Bahamut
Out of curiosity, any reason why the vim script isn't minified if it is so
huge?

------
csmuk
Genuinely much more impressive than I was expecting! Well done!

------
jimmaswell
Too slow for me on FF.

~~~
FurrBall
Too slow for me on Chrome.

------
couchand
so... what exactly am i supposed to do with no file system?

~~~
klapinat0r
Fork it and have it save in _localStorage_ , or _POST_ (ajax or _< form>_) it
to your host site for saving.

One idea could be to bundle it with haste[1] or similar.

[1] [https://github.com/seejohnrun/haste-
server](https://github.com/seejohnrun/haste-server)

------
rch
Why not Acme.js yet?

------
taf2
fantastic! One issue - I keep hitting is using the backspace key in chrome is
mapped to the back button... so it keeps taking me back here..

------
swah
Totally failed when I tried backward-delete-word.

------
dkersten
Ctrl-[ and Ctrl-c don't work :'(

Still good job!

~~~
icholy
Ctrl-[ seems to work for me

------
marveller
I use Vim for everything, this is great!

------
kidambisrinivas
Can it take in custom vim rc files?

------
mseepgood
"ciw" doesn't work.

------
0xdeadbeefbabe
Hrm ctrl+w dang.

