tags:

views:

1646

answers:

13

or "How do I answer questions on SO in Firefox using gVim inside the textboxes?"

+2  A: 

One way to do this is to use the vimperator extension - of course, that does a lot more than what you're looking for.

zigdon
+23  A: 

It's All Text!

From the extension page:

At the bottom right corner of any edit box, a little edit button will appear. Click it. If this is the first time you've used "It's All Text!" then you will be asked to set your preferences, most importantly the editor.

The web page will pop up in your selected editor. When you save it, it'll refresh in the web page. Wait for the magic yellow glow that means that the radiation has taken effect!

Blair Conrad
A word of caution for others: After setting the editor to gVim on WinXP I got an "Unable to open editor" error which stumped me for a while. Turns out that you need to restart Firefox each time you make a change to your editor!That said, this comment was written in "It's all text"! Thanks SO!:wq
If this is still a problem, please report it at http://trac.gerf.org/itsalltext -- Thanks!
The Doctor What
+4  A: 

The "It's all Text" extension, perhaps?

http://addons.mozilla.org/en-US/firefox/addon/4125

Erik Forsberg
+11  A: 

Vimperator makes Firefox act very much like VIM:

Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor. It has similar key bindings, and you could call it a modal web browser, as key bindings differ according to which mode you are in.

Jason Terk
Vimperator is awesome! Thank you. "It's all text" answers the question more directly though.
Once you have the cursor in a text box, hit Ctrl-I to open in your editor, which defaults to gvim.
Hamish Downer
+3  A: 

It's All Text! will let you use whatever editor you want. To use vim with it, you'll need a small shell script to open it in a terminal:

#!/bin/sh
exec xterm -e /usr/bin/vim "$@"

If you have GVim, you won't need the shell, script, obviously.

Clinton R. Nixon
Thanks! Don't know why your shell script example wasn't working for me, but gvim worked great, as you suggested.
molecules
+6  A: 

ViewSourceWith is another addon worth lookng at. It supports more than just edit boxes and text. For example, you can configure it to open images in the GIMP.

Another feature that I find useful is that it can pop-up a dialog box that shows all the js and css scripts used on the page. You can then choose to view/edit file in your preferred editor.

For answering questions on SO, you may also want to get the Vim Markdown Syntax file

erichui
+1  A: 

You can also use the ViewSourceWith addon to achieve the same. Just right-click on any text input and you can edit it using Vim.

Swaroop C H
+1  A: 

As said by others, as a Vi/(g)Vim user you'll probably want to look at the Vimperator addon, which also provides the what you ask: inside a textbox, hit <C-i> to launch the external editor. (can be defined in _vimperatorrc: set editor=gvim -f )

sotto
A: 

At the time of writing it is experimental, but the jV extension looks good. To quote from the page:

This extension makes all html textareas into a very stripped-down version of Vi[m]. It's modal, supports infinite undo, has register support, search, visual mode, and various movement and editing commands.

Hamish Downer
I tried it and it was a bit too buggy for my liking.
Simon Hartcher
A: 

If you use vimperator and have the markdown syntax file installed, a useful line for your .vimperatorrc is:

au LocationChange .* :set editor="gvim -f"
au LocationChange stackoverflow\.com :set editor="gvim -f -c 'set ft=mkd'"

This will tell vim to do syntax highlighting for markdown when you are on stackoverflow.com, but not when you are any other site. There are similar hacks for wikipedia/mediawiki etc. Enjoy :)

Hamish Downer
A: 

There is an experimental way to directly embed the real vim in firefox using embedded editor - though it requires mozplugger and will only work on Linux.

Hamish Downer
A: 

When using Vimperator in Windows (I am using Vista) you may need to double-escape the path to gvim.exe to use it as the external editor. Single escaping did not work for me as Vimperator unescapes it twice. Eg:

:set editor="C:\\\\Program\\ Files\\ (x86)\\\\Vim\\\\vim72\\\\gvim.exe" -f

Then while in a text box you use Ctrl+I and it will open gvim for editing. When you save and exit it will update the text box.

Simon Hartcher
A: 

A hint for Mac users: if you want to use "It's all text" with vim, the easiest way is to use http://code.google.com/p/macvim/ . Point "It's all text" to the mvim script that's provided along with the .app (you can place this script anywhere, I choose /usr/bin/ so that I can load mvim from the command line)

nick