Is there a Firefox add-on to use vim to edit textboxes? - firefox

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

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!

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.
Once you have the cursor in a text box, hit Ctrl-I to open in your editor, which defaults to gvim.

The current answers don't work anymore now that Mozilla removed XUL in favour of WebExtensions. With recent firefox versions, there are the following options (sorted in descending order by the current popularity on addons.mozilla.org).
GhostText provides instant synchronization between editor and textbox via editor-specific plugins. The project is on github and the vim extension is written in Tcl.
withExEditor is cross-platform but requires a native application written in node.js. In addition to editing text fields it also allows viewing the source of the page, MathML, SVG and the current selection. The project on github and the native node.js application
Textern requires a (currently) Linux-only native application written in Python. Synchronizes the content of the text field while you type in the editor. The extension and the native app can be found on github

Tridactyl is probably what you're looking for nowadays.
It's the spiritual successor to the likes of Pentadactyl and Vimperator, which are not available for the current version of Firefox.
If you want something more like It's All Text, where the editing area appears right on top of the browser text area rather than launching an editor window, and you're willing to use Neovim, check out firenvim.

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.

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

The "It's all Text" extension, perhaps?
http://addons.mozilla.org/en-US/firefox/addon/4125

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 :)

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

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.

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.

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.

Try out the wasavi extension. You might want to check out the all versions page to make sure you try out the latest version. (Copy of this answer.)

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.

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 )

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)

Pterosaur is a Firefox plugin that allows you to use Vim in all input fields. It uses an actual Vim process in the background so it has all the functionality you expect, including reading your .vimrc configuration and your plugins.

With Firefox-57 on Linux, I installed textern https://addons.mozilla.org/en-US/firefox/addon/textern/, and found it to be a suitable replacement for ViewSourceWith for editing text boxes.

Related

How to use Vim in a part of Terminal with Go

I'm trying to create TUI app with Go.
I'll make this app like dashboard.
And I want to use Vim as a part of Terminal(iTerm2) screen.
And I want to use local vim env(NeoVim, Local vimrc and plugins).
How do I use local vim with go?
Or are there go libraries to use local vim?
My English isn't so good so feel free to ask me if there is anything unclear.
Thank you.
What you're trying to do is inordinately difficult to do, and I would advise against it.
The only way to embed a terminal application like you're describing is to essentially implement a terminal emulator within your application and display its output within your application. There are libraries which can make this easier -- like libvterm, which vim uses to implement the :terminal command -- but even so, doing this will be difficult, particularly if you want to support advanced terminal functionality in the embedded editor (like mouse support).
A more common idiom for making an editor available in a terminal application is to launch the editor as a subprocess on demand, allowing it to "take over" the entire terminal while a file is being edited. Once the editor exits, your application can resume.

is it possible to map Vim key bindings for windows, just like vimium for chrome

is it possible to map Vim key bindings for windows? just like vimium for chrome. I don't like the mouse sometimes.
using vimium, I can press 'f' to generate 'names' for the link, and just press the name to open the link, it's awesome!
This is an AutoHotKey script that implements some of the vim functions in all applications.
Also LabelControl provides some label support, like vimium, but it's not always that useful.
you can use hunt-n-peck .
you should download binaries from continous integration artifacts.
this is the hunt-n-peck binaries zip link HuntAndPeck taken from repository's continuous integration artifacts.
I don't know about any existing tool, but macro tools like AutoHotkey allow to implement that. For a purely modal solution like in Vim, you'd need to save the mode state (and probably also indicate it somehow), which is difficult. Creating vim like functionality with autohotkey ahk outlines a solution (for navigation) that relies on another simultaneously pressed key instead.
To answer the stated question: Yes, and there exists several, but they have limitations. The best way that I know of is using AutoHotkey, which can be used to add several of Vim's features.
Due to how Vim commands work, it is only partially possible, as implemented in several forms. For several examples you can search for e.g. "autohotkey vim".

Gimp/Mac: Text tool interprets keystrokes as commands

I wonder if you can help me with this rather bizarre phenomenon.
I'm using Gimp 2.8.3 on a Mac OS 10.9.5 and I try to insert text with the Text Tool. Easy enough, but when I type e.g. "Jazz", I get as far as "J", and then the "a" is interpreted as command and the airbrush tool gets activated. This happens with every (lowercase) key which in principle has a command function.
I checked the manual but there's no mention of something that needs to be switched off to use the text entry tool.
Anybody seen this before?
Thanks, Rob
Update: I've had the brilliant idea to check for Gimp updates. Turned out, there's a Gimp 2.8.14 now, which doesn't show this behaviour anymore. So, it seems to have been a bug in Gimp which luckily has been fixed.
Just for the record: if anyone is hit by this or a similar bug, there is a workaround if upgrading/fix is not an option: gimp 2.8, the old off-image text editor for creating text can be used, by checking the Use editor control in the text tool options.
GIMP will them pop a small blank window where the text can be typed without being intercepted by other parts of the application.

Is there a way to make a link clickable in the OSX Terminal?

I am planning on developing an Mxmlc to Textmate formatter, one that formats mxmlc errors as clickable links, so you can open them up quickly in Textmate as Textmate has a url scheme e.g.: txmt://open/?url=file://~/.bash_profile&line=11&column=2.
I am wondering if it is possible to display links in your OSX terminal, that are also clickable, e.g. by changing the PS1 variable or so.
ps. I don't want to use HTML that runs in the Textmate environment.
Before OSX Lion:
cmd+shift+double-click on a URL in Terminal.app and it will open in the default program.
OSX Lion:
cmd+double-click (otherwise you will enter fullscreen mode).
You can right click on a URL in Terminal and the first option in the context-sensitive menu is "Open URL". Not perfect, but maybe good enough ?
Others have discussed how you can select and Command-click on text which is a valid URI. As for Command-clicking on an embedded hyperlink, just like an anchor in hypertext (i.e., where the displayed text is not the URI itself), I believe the short answer is: Terminal cannot do it, but iTerm2 can.
Bash (or any other program that prints to a tty) can output the appropriate escape sequence to create a clickable hyperlink: it is \x1B]8;;URI\x1B\\TEXT\x1B]8;;\x1B\\, where \x1B represents the escape character, \\ represents a literal backslash, URI is the URI you want to link to (starting with https://, file:///, or whatever), and TEXT is the text you want to actually appear, for the user to Command-click on. (You can also use \a, the alert or bell character, instead of both instances of \x1B\\, but I understand this is less standard.) For example:
See \x1B]8;;file:///path/to/help/file\x1B\\the help file\x1B]8;;\x1B\\ for details.
In Mac OS(X), under El Capitan in my case, this works perfectly with iTerm2, and shows:
See the help file for details.
except that the linked text the help file has a dotted underline instead of being in italics. Command-clicking anywhere on the linked text opens the specified URI in the default browser. (Incidentally, this is also the behaviour in the Terminal program in Ubuntu Linux.)
In Mac OS(X) Terminal, you just get:
See the help file for details.
with no special typography and no ability to Command-click on any part of it.
You can get the full detail, including a list of supporting terminals, at https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda.
Pipe your output to lynx:
your_command | lynx -use_mouse -stdin

Open dot-file with dialogue in OSX

Since the GUI-side of OSX treats all dot-files (such as .htaccess) as hidden, it doesn't display them in any of the graphical UI:s, e.g. Finder or the Open-dialogues.
How can I open a dot-file (.htaccess in this case) in a graphical editor, without doing that thing for all hidden files, universally and without going through Terminal.app?
Edit: I'm on Leopard, if that makes a difference.
Edit2: TextWrangler and TextMate seem to have features that allow you to open hidden files, which partly answers my question.
In an "Open File" dialog you can use Command-Shift-. to see dot files.
You could tell Finder to display hidden files as well (enter in Terminal):
defaults write com.apple.finder AppleShowAllFiles TRUE
But that’s not really nice since there are a lot more hidden files. So I recommend to use an editor that allows you to view those in the open dialog like Chuck mentioned.
If you only want to do this for one specific file, you can create a symbolic link to the dot-file. Open up Terminal.app, cd to the directory containing your dot-file, and run
ln -s .htaccess dot_htaccess
Then you should be able to double-click the file dot_htaccess as a regular file, and any edits you make will really go into .htaccess.
TextMate (a really nice text editor for OS X) open dialog has a "Show hidden files" option, and TextWrangler (and its big brother BBEdit) has it has a menu item.
In the command line, for a file named FILE, type:
open -e FILE
The open command will open the file in TextEdit (-e flag). Check out "man open" for more flags (e.g., specify the app to open with -a)
Smultron (another nice OS X editor mentioned in the comment above and similar to TextMate, but free) has an "Open Hidden..." file menu item that works splendidly for this purpose.
Sad news: Smultron is apparently no longer being developed further beyond v3.5.1 (which requires Leopard), according to a post from its author at its homepage: http://tuppis.com/smultron/
jEdit is another free option that has hidden file support: www.jedit.org/users-guide/vfs-browser.html (sorry for the lack of 'http' in the link -- being a new user, my posts are limited to just one link. Alas...)

Resources