I love VI and I'm looking for a plugin of some sort that would allow me to input text in my browser (preferably Firefox or Chrome) using VI commands. It would save me an immense amount of time and at the same time when writing long emails. Can anyone think of any plugins that would allow me to do this? I was hopeful with Vimperator (https://addons.mozilla.org/en-US/firefox/addon/4891) but after installing it, I realized that it didn't do the one VI think I wanted to do: create or edit a text box with VI commands. It just allowed me to do Browser commands and scrolling in VI-style.
since you have installed Vimperator , you can try this :
se
editor=”YOUR-GVIM-PATH/vim72/gvim.exe
-f”
Press Ctrl + i to call gvim to deal with the text you want to edit.
I've had great luck with itsAllText firefox extension. Probably not as smooth as your dream, but it works very well in practice.
https://addons.mozilla.org/en-US/firefox/addon/4125
I've been using the Mozex extension for Firefox for years.
http://mozex.mozdev.org/
Once installed, on the "Textarea" tab, assign a hot-key and enter the command to run. For example:
gnome-terminal -e "/usr/bin/vim %t"
When the hot-key is pressed, Mozex will create a temporary file and replace the "%t" above with its name.
If there's more than one text area on a page it will allow you to pick which one you want to edit.
Mozex provides a lot more functionality than just text area editing. If you want to "view source" with Vim, you can do that too.
I've used jV for a while on firefox. It works even with newer versions that the extension doesn't officially claim to support. The dev says they are working on a chrome version.
Currently the Chrome Extensions API is fairly simple; I simply don't think that there are currently enough API hooks into the browser to be able to support something like this.
You might want to check out the confusingly-named Conkeror browser (not the same as Konqueror in Linux), which is best described as the love child of VI and Firefox. It's like VI with the Gecko rendering engine (I think).
Related
For the most part I very much like Qt Creator, but a few projects I'm working on require me to switch between my editor and my web browser for reference. Qt Creator is currently interpreting Alt+Tab to autocomplete, and then switching my window focus; this is a mild problem but it's really starting to get to me.
I've tried going to Tools→Options→Keyboard and searching for Alt+Tab, but found nothing. Is there a way to get it to selectively ignore the key combination without disabling autocomplete on the whole?
To complete the picture, I'm on Linux Mint 19.04 using XFCE desktop environment; or occasionally Maté. If I need to access something in system settings to do this I'm happy to; I just don't want to keep excessively second-guessing my code when I return to it.
Auto-complete is bound to Ctrl+Space by default, not Alt+Tab. In tools/options/keyboard, search for "CompleteThis" to see what it's bound to.
Maybe what you want is to disable auto-complete and use only manual-complete? That is, have the auto-complete list only show when you press ctrl+space, but never automatically. You can do that in options/text editor/completion.
I have several cpp source files in tabs in vim. I would like to have another tab with command prompt in order to run make. I open net tab , run sh and now I have console. But how to move from this console to other tabs? If I press ctrl+page up I have garbage in console and no tab change. How to move to another text tab when staying in console tab?
As I said, vim 8 or neovim both have an terminal emulator in it.
Since you are using vim 7 here are some other ways:
Tmux as #wizzup mentioned is perfect for this use-case. I think it is the most used Terminal-Multiplexer and extremly mighty. It is complex in comparison but since you are using vim, a steep learning curve should not be a killer point. However there are a few cavehats but you will find thousands of articles to solve them.
GNU Screen is an alternative to tmux, I have no experience with it, but should be usable pretty good with vim too.
With them you can use something like this Plugin which allows you to use the terminal in vim itself. However I haven't tested it but it seems to be rather groomed.
Long ago, I was using the hack given in http://vim.wikia.com/wiki/VimTip805 . This hack allowed me to edit any active window frame using gvim. For instance, I was able to edit my gmail replies using gvim.
Unfortunately, the hack does not work to me any more. Is there any other way to achieve the same? Or at least to achieve the same using some concrete browser (for example, firefox)?
Google Chrome
you can use GhostText with running server vim-ghost. Its not ideal, but allow to interactively use external editor (text is automatically copied to a web textarea element each return to normal mode).
Vim-ghost is written in tcl so you need install tcl.
In my case I have tcl installed but without standard library tcllib. So I found lacking packages in tcllib (tcllib/module/sha1 and tcllib/module/json) and copy them to a folder listed in tcl path (the first result of echo $tcl_pkgPath). More info: man pkg_mkIndex or here.
Of course vim-ghost server must be run (eg. in autorun script):
~/.ghost-text-server.tcl &
You can also like Vimium to navigate through web using links, tabs, j, gg and many vim-like features.
You should check vimperator( pentadactyl, which is a fork of vimperator). They offer the ability to edit text boxes, but also offers several additional functions that allow you to control firefox in a similar way to Vim.
If you prefer Vim only for edit text boxes you could try the firefox plugin "It's all text", as mentioned by Kent.
I'd recommend It's All Text plugin for Firefox.
I realized that I waste 10% of my time changing windows between Vim and Firefox.
Alt + Tab + F5 (and sometimes a get the wrong window).
Is there a way of making this task easier?
I thought of the following:
Embending vim to firefox (I think it is impossible).
Making a Vim shortcut which sends me to Firefox's window.
Any suggestions?
Technically, I guess this ain't proper answer, but You might benefit from these tools.
For Chrome - try LiveReload.
For Firefox - try XRefresh.
Here's a Vim shortcut to open the current file in Firefox. It should work on Ubuntu, though I'm not in front of my Linux machine to test. You can add it to your ~/.vimrc
map <Leader>p :!firefox %<CR><CR> " Preview the current html file in Firefox
If you're looking for varations on that same theme, there are quite a few similar tips on the Vim wiki. Check the duplicate links tip at the top and the "See Also" links at the bottom.
If you are on Windows, AutoHotKey is a good free option.
You could assign a key combination to activate the Firefox browser, send the F5 key to Firefox, and then return focus to Vim.
Benefits of AutoHotKey:
You could have logic that checks whether the Firefox is open, and if it is not open, open it.
You could use the AutoHotKey Window Spy tool to actually activate Firefox. Alt+Tab will fail if you've activated another window in between Vim and Firefox.
See for example:
http://www.autohotkey.com/docs/commands/WinActivate.htm
http://www.autohotkey.com/docs/Tutorial.htm
Google Chrome is set as the default browser. However, it opens links in Firefox, which is undesired.
How can I make Org-mode to open links in Google Chrome?
Emacs 23.2 doesn't directly support Google Chrome, but it does support a "generic" browser, and something like this should work:
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "chromium-browser")
You don't mention your OS, but if it's Windows or Mac, you can try:
(setq browse-url-browser-function 'browse-url-default-windows-browser)
(setq browse-url-browser-function 'browse-url-default-macosx-browser)
And, if that doesn't work, there are other folks who have implemented 'browse-url-chrome. Google turned up the following link:
http://code.ohloh.net/search?s=browse-url-chrome&browser=Default
As Trey suggests, you can set it to a generic browser, but instead of "chromium-browser" use "google-chrome", like this:
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "google-chrome")
That worked for me with Emacs 23.2 and Chrome 12.
I have a similar problem (although the other way around: I wanted Emacs to open Firefox, but it opened Chromium).
I'm using Ubuntu 12.04 (Precise Pangolin), but already had the problem with Ubuntu 11.10 (Oneiric Ocelot). The solution below applies to Linux, maybe macOS (?), and probably not Windows.
Setting browse-url-generic-program as suggested in other answers didn't work for me. Note also that my default browser is generally Firefox: that's what most other applications are using to open a URL, including xdg-open. So I was surprised that Emacs would do otherwise.
I finally figured out that Emacs is using the sensible-browser (1) script. Looking at that script, I noticed that:
it first looks at the BROWSER environment variable;
else, it tries several other generic scripts, starting with gnome-www-browser
It so happens that, on my machine, BROWSER is not set, but gnome-www-browser is a script apparently put there by Chromium, and (naturally) running Chromium.
So, long story short: putting the following line
export BROWSER=firefox # Or any browser of your choice
in your .profile may help if Emacs is not using the correct browser.
Setting the browser function is very easy using the GUI:
In the menu, click Options > Customize Emacs > Top-level customization Group
Click on the link External (Interfacing to external utilities.)
Click on the link Browse Url (Use a web browser to look at a URL.)
Click on the small triangle to the left of Browse Url Browser Function, this reveals a Value Menu button and some help text
Click the Value Menu button
Choose your preference from the displayed menu
Move to the top of the buffer, click the button Apply and Save to save the change to your ~/.emacs file
Done :-)
I also had this problem when exporting org files to HTML. It would use Firefox instead of a Chromium browser. I fixed it by customizing org-file-apps (which for some reason had been set to open XHTML and HTML files with Firefox).
I now have an entry for extension \.x?html?\' with command set to the Lisp form: (browse-url file)
I was on macOS and the browse-url-default-macos-browser did not work for me.
My solution was:
(setq browse-url-browser-function 'browse-url-chrome)
(setq browse-url-chrome-program "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"))
For ChrUbuntu, the google-chrome incantation as given by Alan Turing works with Emacs 23.3.1, the default as of today. I suspect the chrubuntu configuration even when tickled to use chromium uses the wrong binary name.
In emacs 28 (Fedora Linux) I just needed this
(setq browse-url-browser-function 'browse-url-chrome)