News for hackers. Stuff that matters.
Re:Vi in JavaScript, in your browser by antirez on Thursday October 15, 2009 @04:07AM (#882973)
Nice, what is missing is a way to have vim (or a decent approximation) in every text area, embedded. There are different solutions and extensions but nothing comparable to vim running in the text area box.

While I'm at it, another thing I miss so much is the ability to tell Firefox (or other browsers) that I write in two languages (Italian and English) so it could automagically switch spell correction dictionary auto sensing the language. This problem is common to at least half the people living in Europe.

Re:Vi in JavaScript, in your browser by nirmal on Thursday October 15, 2009 @08:15AM (#883220)
This comment made me realize that I've been using emacs commands for textareas in Safari/Firefox without thinking about it. Most of them seem to be there, at least for moving around within the text. Does this just work under OS X?
Re:Vi in JavaScript, in your browser by epe on Thursday October 15, 2009 @04:56PM (#884256)
A lot of them do "just work", and the rest can be made to. See http://www.hcs.harvard.edu/~jrus/site/Cocoa%20Text%20System.... for the full story, or create a ~/Library/KeyBindings/DefaultKeyBinding.dict file that contains something like:

  {
      "~d" = "deleteWordForward:";
      "~f" = "moveWordForward:";
      "~b" = "moveWordBackward:";
  }
The "~" means "Meta"; all this does is set up M-d, M-f, M-b to work like they do in Emacs.
Re:Vi in JavaScript, in your browser by antirez on Thursday October 15, 2009 @08:34AM (#883233)
I think this works everywhere. Being vim a modal editor is not possible to "hide" vim bindings :)
Re:Vi in JavaScript, in your browser by stcredzero on Thursday October 15, 2009 @09:12PM (#884585)
Nice, what is missing is a way to have vim (or a decent approximation) in every text area, embedded

This sounds like something OS X or another ambitious and slick operating system should provide: the ability to use the text editing engine of your choice in every textarea on your machine.

Re:Vi in JavaScript, in your browser by mhansen on Thursday October 15, 2009 @05:06AM (#883028)
It's not picking up escapes (Google Chrome 4.0.221.6)
Re:Vi in JavaScript, in your browser by Hates_ on Thursday October 15, 2009 @07:24AM (#883150)
Same for me in Safari 4.0.3.
Re:Vi in JavaScript, in your browser by ams6110 on Friday October 16, 2009 @10:01AM (#885379)
CTRL-[ works as an alternative.
Re:Vi in JavaScript, in your browser by rudenoise on Thursday October 15, 2009 @05:03AM (#883023)
Are there any other similar projects out there?

I was thinking about attempting a VIM plug-in for Bespin (https://bespin.mozilla.com/) that could also be used as an FCK/TinyMCE style textarea add-on.

Re:Vi in JavaScript, in your browser by MikeHawk on Thursday October 15, 2009 @05:17AM (#883039)
Not recommended for Vimpertator users. I just acciendentally quit my browser session without knowing it.
Re:Vi in JavaScript, in your browser by gfodor on Thursday October 15, 2009 @09:33AM (#883335)
Hit ctrl-Z for pass through mode to use it.
Re:Vi in JavaScript, in your browser by MikeHawk on Thursday October 15, 2009 @10:39AM (#883446)
many thanks!
Re:Vi in JavaScript, in your browser by jrockway on Thursday October 15, 2009 @08:07AM (#883204)
Almost the same with conkeror. Very amusing.
Re:Vi in JavaScript, in your browser by manish on Thursday October 15, 2009 @03:39AM (#882954)
Wow, simply great. It would be nice to open files in your computer and use them. I could not open any file by :n filename command. Also record command, which is very useful is missing. I am not sure for what this can be used?
Re:Vi in JavaScript, in your browser by past on Thursday October 15, 2009 @04:04AM (#882971)
It can be used for adding a vi mode to any web page editing scenario you might have a need for. If you want to edit local files from your browser, I've made a Firefox extension that does just that:

http://past.github.com/despin/

It doesn't have a vi mode (yet) and lots of other things, but I'd be interested to see if people found it interesting and useful.

Re:Vi in JavaScript, in your browser by yeahit on Thursday October 15, 2009 @04:56AM (#883021)
As a VIM user, these things irritated me:

1) I cannot delete the end of a line with this thing. Is that normal? Im only used to VIM so this might be a VI thing.

2) CLTR+ does not scale up the font size

Re:Vi in JavaScript, in your browser by cturner on Thursday October 15, 2009 @06:03AM (#883081)
> Is that normal?

Yes. You're not "meant" to be able to backspace over content that wasn't added in your current transaction. Which is really inconvenient, because if you delete things when you're in command mode then it overwrites what's in your buffer, which is often convenient.

In vim you can simulate this by doing

    :set compatible
Re:Vi in JavaScript, in your browser by mjgoins on Thursday October 15, 2009 @10:53AM (#883479)
It crashed on me (or rather, became totally unresponsive) when I deleted the whole buffer with a "dG" command.

running iceweasel 3.0.6

Re:Vi in JavaScript, in your browser by stcredzero on Thursday October 15, 2009 @09:16PM (#884589)
I hope that this was done with a C compiler that can target Javascript!
Re:Vi in JavaScript, in your browser by afed on Thursday October 15, 2009 @03:54AM (#882963)
Good job, now learn a real language.
Re:Vi in JavaScript, in your browser by brazzy on Thursday October 15, 2009 @04:46AM (#883015)
Re:Vi in JavaScript, in your browser by jrockway on Thursday October 15, 2009 @08:08AM (#883207)
Anime image macros! Yes!

I think HN is finally mainstream.