Live data from Hacker News

Web Vi

code.google.com

1–10 of 27 posts

Re: Web Vi

#2
I had a brief play around with the example, and pretty quickly came across bugs and unimplemented commands (for example: 'b', 'e' and 'O' are missing, but 'o' acts like 'O'). I like the way the cursor changes colour to hint at the current mode.

However, what I'd really love would be a bookmarklet I could click to Vi-ify every on the current page. I've got "It's All Text" set up in Firefox to open s in gvim, but it's still clunkier than editing right there in the page.

Re: Web Vi

#3

I had a brief play around with the example, and pretty quickly came across bugs and unimplemented commands (for example: 'b', 'e' and 'O' are missing, but 'o' acts like 'O'). I like the way the cursor changes colour to hint at the current mode. However, what I'd really love would be a bookmarklet I could click to Vi-ify every on the current page. I've got "It's All Text" set up in Firefox to open s in gvim, but it's…

+1 on that bookmarklet. Would be very helpful in a lot of cases.

Re: Web Vi

#4

I had a brief play around with the example, and pretty quickly came across bugs and unimplemented commands (for example: 'b', 'e' and 'O' are missing, but 'o' acts like 'O'). I like the way the cursor changes colour to hint at the current mode. However, what I'd really love would be a bookmarklet I could click to Vi-ify every on the current page. I've got "It's All Text" set up in Firefox to open s in gvim, but it's…

The Pentadactyl plugin for Firefox (http://dactyl.sourceforge.net/pentadactyl/), which is a better-maintained fork of the well-known Vimperator, allows you to hit in any textarea or text input to enable Vim-style keybindings inline. opens the text for editing in an actual Vim instance, like the plugin you mentioned.

Of course, Pentadactyl changes a lot about how the browser works beyond just text editing, so it may not be for everyone.

Re: Web Vi

#5

I had a brief play around with the example, and pretty quickly came across bugs and unimplemented commands (for example: 'b', 'e' and 'O' are missing, but 'o' acts like 'O'). I like the way the cursor changes colour to hint at the current mode. However, what I'd really love would be a bookmarklet I could click to Vi-ify every on the current page. I've got "It's All Text" set up in Firefox to open s in gvim, but it's…

Bookmarklet:

  javascript:(function(){var d=document;var s=d.createElement('script');var t=d.getElementsByTagName('textarea');s.setAttribute('src','http://webvi.googlecode.com/svn/trunk/lib/webvi.js);d.body.appendChild(s);for(var i in t){if(typeof t[i]=='object')t[i].setAttribute('class','webvi');}webvi_init();})();

Re: Web Vi

#6
I'm rather skeptical about text editors implemented on top of the canvas element. Mozilla has already tried that with Bespin project and it failed miserably (huge code base, poor performance, limited accessibility).

Wouldn't it be easier to just use div element with contentEditable attribute? Currently contentEditable has limited API and a lot of inconstancies across browsers, but in the longer run it seems to be the way to go: http://ehsanakhgari.org/blog/2011-08-31/future-editing-web

Re: Web Vi

#7

I had a brief play around with the example, and pretty quickly came across bugs and unimplemented commands (for example: 'b', 'e' and 'O' are missing, but 'o' acts like 'O'). I like the way the cursor changes colour to hint at the current mode. However, what I'd really love would be a bookmarklet I could click to Vi-ify every on the current page. I've got "It's All Text" set up in Firefox to open s in gvim, but it's…

No kidding. The first thing that I tried immediately wasn't supported (capital 'C' to start typing over the first line).

Would be very nice once it gets more mature, though.

Re: Web Vi

#8
The one thing that most vi-mode implementations don't get is that vi(m) is really about the possibility to configure every keystroke. Its not about "j" is "up" and "dd" deletes the current line.

Re: Web Vi

#10
post #5

I had a brief play around with the example, and pretty quickly came across bugs and unimplemented commands (for example: 'b', 'e' and 'O' are missing, but 'o' acts like 'O'). I like the way the cursor changes colour to hint at the current mode. However, what I'd really love would be a bookmarklet I could click to Vi-ify every on the current page. I've got "It's All Text" set up in Firefox to open s in gvim, but it's…

Bookmarklet: javascript:(function(){var d=document;var s=d.createElement('script');var t=d.getElementsByTagName('textarea');s.setAttribute('src','http://webvi.googlecode.com/svn/trunk/lib/webvi.js);d.body.appendChild(s);for(var i in t){if(typeof t[i]=='object')t[i].setAttribute('class','webvi');}webvi_init();})();

Thanks for that!

I had to make some changes to get it working on my machine:

  javascript:(function() {var d=document;var t=d.getElementsByTagName('textarea');for(var i in t){if(typeof t[i]=='object') t[i].setAttribute('class','webvi');}var s=d.createElement('script');s.async=false;s.setAttribute('src','http://webvi.googlecode.com/svn/trunk/lib/webvi.js');d.body.appendChild(s);webvi_init();})();
In particular, you missed a ' in the .setAttribute() call, and I had to set .async=false on the script element so that it would load and execute it before trying to call webvi_init().

EDIT: No, that doesn't work either. It runs in Firebug if I paste it into the console and remove the "javascript:" prefix, but it doesn't run as a bookmarklet: it just complains about webvi_init() not being defined, even though the async flag is cleared. :(((

Post reply on HN