17 ms·
Vim.js - JavaScript port of Vim
- xcyu 13y agoThis is pretty cool. Backspace not working for me though in Chrome.
- bromagosa 13y agoSame here, Chrome on Debian. Backspace and ESC not working, so after I enter a mode I'm stuck in it forever.
- bilalq 13y agoReally 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 13y ago… 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.)
- wging 13y agoChrome and Firefox. Probably IE too.
- shmerl 13y agoNo, at least for me (Firefox on Linux) Backspace doesn't do anything special.
- roryokane 13y agoThe “backspace = back” behavior of Firefox is only enabled by default on Windows. The behavior is controlled by the about:config setting `browser.backspace_action` (http://kb.mozillazine.org/Browser.backspace_action http://kb.mozillazine.org/Browser.backspace_action).
- Ar-Curunir 13y agoNot on Linux, where the 'previous page' action is mapped to Alt-left by default. After being initially frustrated, I got really used to Alt-Left for going back. The reasoning behind it is pretty smart too, because numerous times backspace can result in the loss of data, like when you're filling up a form and you hit backspace outside of a text box.
- lelandbatey 13y agoIndeed, I like the 'alt-left' keyboard shortcut, though I especially like it because it does the same thing in both Chrome and Firefox on both Windows and Linux! Yay for consistency!
- markburns 13y ago_I_ use backspace for navigation. What's the alternative? Use a mouse?
- sanxiyn 13y agoAlt-Left.
- roryokane 13y agoOn Mac OS X, the standard shortcut is Command-[ instead (and Command-] is Forward).
- dethstar 13y agoif you use vimium/vimperator/something else you can do shift+H to go backwards, shift+L to go forward.
- octagonal 13y agoWhich would require me to press two keys instead of one.
- 13y ago
- oneeyedpigeon 13y agoThere are still browsers that don't maintain form state across back/forward history? (I'm a little surprised by this because I thought all browsers used backspace for back)
- dlau1 13y agoI tried typing some gibberish and one shortcut that seems to be a bit broken for me is yiw diw Hmm, actually it seems all the motions I tried didn't work :-( http://vimdoc.sourceforge.net/htmldoc/motion.html#word-motions http://vimdoc.sourceforge.net/htmldoc/motion.html#word-motio...
- waitingkuo 13y agoWow, I can use hjkl to move my cursor !!!
- yepguy 13y agoKinda cool as a demo, but too many vim shortcuts are hijacked by the browser for this to be useful to me.
- taf2 13y agofantastic! 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..
- cauliturtle 13y agonice but `backspace` then I returned to > https://news.ycombinator.com/item?id=6899072 https://news.ycombinator.com/item?id=6899072
- pyramation 13y agosame here, cool idea though.
- marveller 13y agoI use Vim for everything, this is great!
- couchand 13y agoso... what exactly am i supposed to do with no file system?
- foobar4321 13y agoyeah, I thought the same ... does a text editor in the browser make sense?
- klapinat0r 13y agoFork 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
- andypants 13y agoIt seems to have some kind of filesystem. You can write files, there's /dev, /root, /tmp and /usr, and vimrc and color settings. Not really sure how it all works, I only took a quick look.
- saosebastiao 13y agoI'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 13y agohttp://dillinger.io/ http://dillinger.io/ you already can
- tunnuz 13y agoThere is also http://stackedit.io http://stackedit.io
- deleted 13y ago[deleted]
- perimo 13y agoIf it's possible to integrate this with BrowserFS, you'd be all set: https://github.com/jvilk/BrowserFS/#browserfs https://github.com/jvilk/BrowserFS/#browserfs
- siddboots 13y agoCan anyone think of a sane way to make this integrate with github?
- camus2 13y agoGiven the size of the "compiled" file, i'd say it's a bad idea . A better idea would be whatever js editor with a vim mode, not c code compiled with emscriptem like this one.
- csomar 13y agoGithub is using the Ace editor, which has a VIM mode.
- lauriswtf 13y agoI 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 13y agoThanks! I was trying to get my head around why vim mode wasn't working. This works great.
- dragonfax 13y agoIts already been done as a chrome extension https://github.com/NickTomlin/pocketvim https://github.com/NickTomlin/pocketvim
- mseepgood 13y ago"ciw" doesn't work.
- deleted 13y ago[deleted]
- tikwidd 13y agoWho wants to make a javascript emacs? you could call it emscriptenmacs..
- vidarh 13y agoymacs (Fabrice Bellards Emacs "clone") is installed in jslinux.
- cristiantincu 13y agoYmacs 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.
- imslavko 13y agoFor Vimium users: don't forget to enter the insert mode in your browser first ;)
- mqzaidi 13y agoRule 34 for software: If it exists, there IS a javascript port of it.
- tlrobinson 13y agoThat 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-least-power.html http://www.codinghorror.com/blog/2007/07/the-principle-of-le... 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 13y agoPatientZero'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. ;-)
- deleted 13y ago[deleted]
- alxndr 13y ago...authored by tlrobinson?
- arethuza 13y agoWhat about emacs in Linux in JavaScript? :-) http://bellard.org/jslinux/ http://bellard.org/jslinux/
- SEJeff 13y agoIt would be missing a good editor. Probably not a bad operating system however
- ra3 13y agoLots 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.
- deleted 13y ago[deleted]
- rch 13y agoWhy not Acme.js yet?
- jimmaswell 13y agoToo slow for me on FF.
- FurrBall 13y agoToo slow for me on Chrome.
- deleted 13y ago[deleted]
- pablovidal85 13y agoVery 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.
- gnur 13y agoAll 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 13y agoIt is built with the compiler flag: --with-features=tiny.
- Xelom 13y agoWaiting for os.js, javascript port of X operating system. And js.js, javascript port of javascript. Javascripteption anyone?
- vidarh 13y agoThere 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
- fhd2 13y agoWhile 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 13y agoWell, 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.js#L478 https://github.com/coolwanglu/vim.js/blob/master/web/vim_lib... [2] https://groups.google.com/forum/#!topic/vim_dev/AQTHbUHijgg https://groups.google.com/forum/#!topic/vim_dev/AQTHbUHijgg
- ehsanu1 13y agoYeah, 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 13y agoThere'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.
- azakai 13y agoThis also does not seem to be compiled with full optimizations, standard emscripten -O2 output looks somewhat different than what is here.
- kidambisrinivas 13y agoCan it take in custom vim rc files?
- marijn 13y agoSee 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 13y agothis is not vim, this is some incomplete bindings implementation.
- csmuk 13y agoGenuinely much more impressive than I was expecting! Well done!
- lorenzfx 13y agoI 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.
- JasonFruit 13y agoI tried it, and now I'm confused and angry! Seems right to me.
- dkersten 13y agoCtrl-[ and Ctrl-c don't work :'( Still good job!
- icholy 13y agoCtrl-[ seems to work for me
- toblender 13y agoOMG 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!
- jay-anderson 13y agoIt 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.
- IgorPartola 13y agoThis... 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.
- yogo 13y agoYep, I constantly have to delete jj at the end of emails. The cool thing about this port is that mapping seems to work. Naturally the first thing I tried was :inoremap jj <esc>, which I don't think works in codemirror + vim plugin.
- squigs25 13y agoWho uses :wq when you can use :x?
- abhinavg 13y agoOr ZZ
- tikums 13y agoWho uses :x, when you can ZZ?
- IgorPartola 13y agoI 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.
- finnh 13y agoThere are browser plugins that let you edit <textarea> elements in your $EDITOR. I use "It's all text!" in Firefox for this purpose and it works well; the workflow is pretty simple: focus in textarea, hotkey to switch to vim, save & close buffer to switch back to the browser. (not affiliated, just a user). You do of course lose rich text formatting.
- swah 13y agoTotally failed when I tried backward-delete-word.
- Bahamut 13y agoOut of curiosity, any reason why the vim script isn't minified if it is so huge?
- Aqueous 13y agodid 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.
- jihip 13y agoVery cool! I know code mirror had vim mode but this. This is something way more awesome.
- volaski 13y agoCool. Now go build NERDTree and Ctrl-P and come back. Then I will use it
- jbeja 13y agoYou still use those?
- 0xdeadbeefbabe 13y agoHrm ctrl+w dang.