Skip navigation

Sign up | Lost password? | Help

Blazeix's Blog

Opera stuff

Vimperator for Opera

, , ,

Introduction

One of the best extensions out there for Firefox (in my opinion, at least) is Vimperator. Quoting from the Vimperator index page, "Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor." I and many of my friends have installed Vimperator, and immediately became addicted to it. It sped up workflow and was fun at the same time. Vimperator is the main reason why I stuck with Firefox so long before switching to Opera.

A while ago I decided to test out Opera, figuring that I'd eventually switch back to Vimperator. Before I switched back, however, I took a look at the versatile keybindings and customization available. I was so impressed I decided to stick with Opera, and recreate the Vimperator functionality. I've emulated some of the features I use the most in vimperator, including common keybindings and the Hit-a-Hint navigation. I've uploaded my configuration to this post, so you can enjoy Vimperator navigation with the speed of Opera.

Installation

To make Opera 9.51 behave like Vim, and by extension Vimperator, follow these instructions:

  1. Download the attached file 'vimperopera.ini' (see bottom of post) and place it in your profile under the 'keyboard' directory. Under Linux, this directory is under:
    ~/.opera/keyboard
    For Windows, look under
    C:\Documents and Settings\user\Application Data\Opera\Opera\profile\keyboard
  2. Open up your preferences window and navigate to Advanced->Shortcuts->Keyboard Setup and choose 'vimperopera'. Press O.K.
  3. (Optional) To get a more authentic Vim[perator] experience, you may want to hide all of your toolbars except for the tab bar and address bar. Do this from the Tools->Appearance->Toolbars tab, and press Shift+m to toggle the menu bar on/off. I put my address bar at the bottom of the window, and kept the tab bar at the top. I hid all the other toolbars.
Using Vimperopera

Now, vim and vimperator are modal programs and Opera, well, not so much. However, I feel very comfortable using the vimperopera keybindings and can switch back and forth between vimperator and vimperopera with ease. Almost all of your trusty vimperator keybindings are available (At least, the ones that I could find mentioned in the Vimperator documentation, which seems to be lacking). All the shortcuts I've grown attached to such as gh (go to homepage), gH (go to homepage in new tab), o, O, t, T, etc. are all working. See the list below for the keybindings.

As I mentioned earlier, hit-a-hint spacial navigation, which I can't live without, has been emulated using Javascript bound to the 'f' key for basic hints and ';' for extended hints.

  • Basic hints ('f') - Displays numbers next to each link. Type the number of link and press enter to go to that link. If the number you type has only one possible hint, that hint will be automatically chosen for you.
  • Extended hint mode (';') - Displays numbers next to each link, and allows you to open multiple links at a time. Type in the numbers of the links you want to follow, separated by a comma, and press enter when you are done. Those links will open in new tabs.

Screenshot of Vimperopera in hints mode

Additional Approvements
  • I found that the Opera Standard Slim Skin, by Tamil, fits well with the whole Vim look. It's a minimalistic skin that decreases the padding of the default Opera skin.
  • I use google bookmarks, so I bound ':' to 'focus address bar', nicknamed the google bookmarks page 'bmarks', and the 'Add to bookmarks' bookmarklet 'bmark'. Now, when I type ':bmarks' and ':bmark' I get a list of bookmarks and a prompt to 'Add page to bookmarks,' respectively.
  • I also dislike how google automatically steals focus for its search bar, so I added the 'blurgoogle' UserJS, see attached.
Hotkeys

Here are a list of the hotkeys available with this keybinding. This list omits the default keybindings for brevity.
Key Combo Description
shift m Toggle Menubar
h move left
j move down
k move up
l move right
H Back
Ctrl o Back
L Forward
Ctrl i Forward
gh go to homepage
gH go to homepage in new tab
gt next tab
gT previous tab
d delete (close) tab
o address bar
O address bar with current url
t new tab
T new tab with current url
gu go up one level
u undo close tab
y yank (copy) current address on to clipboard
p paste clipboard contents
P paste clipboard contents into new tab
i focus first form field
gi focus previous form field
[[ Rewind
]] Fast forward
r refresh page
/ find
n find next
N find previous
Ctrl Insert Copy
Shift Insert Paste
zi zoom in
zo zoom out
wq hide opera
ZZ quit opera
e open xterm
Ctrl q, dw delete a word in a text field
Ctrl q, dd clear a text field
Ctrl q, d$ delete to end of line
b bookmark
ctrl b bookmark list
m mail
: focus address bar
f hints mode
; extended hints mode


Download

vimperopera.ini - Keyboard Configuration

blurgoogle.js - Optional BlurGoogle UserJS


Credits and Changes
  • A big thanks to Calmar's Opera keybindings, which served as an excellent starting point!
  • mksdcom let me know about the e.preventDefault() call, thanks! I've updated vimperopera.ini to call this function.
  • 7/7/08 - Made extended hint mode more robust
  • 2/28/09 - Made normal hint mode open in current page, like FF's vimperator does. Added Page[Down,Up], Home/End, and Ctrl[+shift]+Tab key bindings due to popular request.

December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31