[go: nahoru, domu]

Skip to content
Phil Crosby edited this page Feb 11, 2024 · 3 revisions

Moving in the Vomnibar's list

When the Vomnibar is open and there is a list of items, you can move down and up through them with the <Tab>/<Shift><Tab>, c-n/c-p or c-j/c-k combinations.

Recently-Visited Tabs

When the Vomnibar is in tabs mode (bound to T by default), tabs are initially ordered by recency. So:

  • T<Enter> takes you to the most recently visited tab.
  • T<Tab><Enter> takes you to the second most recently visited tab.
  • And so on.

Prefix Count Arguments

As in vim, many Vimium commands accept a prefix count argument. For example, K moves one tab to the right, so 3K moves three tabs to the right.

Searching Bookmarks by Folder

When the Vomnibar is in bookmark mode, you can search for bookmarks by folder. By including / in the query, the query will also be matched against the names of bookmark folders. For example, to find bookmarks related to the BBC in the "Mobile bookmarks" folder, try:

/mob bbc

Smooth Scrolling

If smooth scrolling is enabled, then press-and-hold j or k smooth scrolls the page down or up. If you find the speed either too slow or too fast, then you can adjust it via the Scroll step size setting on the options page.

Smooth scrolling is enabled by default, but can be disabled on the options page (under advanced options).

Frames

Some web pages use frames. The gf command can be used to move the focus between frames. When selecting frames in this way, the border of the active frame flashes yellow.

Nevertheless, on pages with many frames, it can be difficult to keep track of which frame contains the focus. The gF command returns the focus to the main frame.

Repeat recent Vomnibar queries

In omni mode (o or O), when the Vomnibar is initially opened, <Tab> opens a list of recent queries and searches. When selected, searches can be re-run or edited.

Similarly, for custom search engines, immediately after launching the custom search engine, <Tab> opens a list of recent queries with that search engine.

Editing the URL of a history item in Vomnibar

If you select an item from your history in the Vomnibar, you can manually edit its URL by typing Ctrl-Enter.

Hovering over links using LinkHints

The LinkHints.activateMode command takes an optional "action" argument, which allows for actions other than "click". You can bind these actions to separate hotkeys. Here's an example:

map X LinkHints.activateMode action=hover
map X LinkHints.activateMode action=focus
map X LinkHints.activateMode action=copy-text

Keyboard shortcuts for custom search engines

Custom search engines can be launched directly with keyboard shortcuts (that is, without the need to open the Vomnibar and enter the search engine's keyword followed by <Space>). Here are a couple of examples.

Custom search engines:

g: https://www.google.com/search?q=%s Google
w: http://en.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedia

Custom key mappings:

map s Vomnibar.activate keyword=g
map w Vomnibar.activate keyword=w

(Note the additional keyword=X option. This selects the custom search engine to activate.)

Configured this way, keyboard shortcuts s and w launch the Vomnibar directly in custom-search mode for Google and Wikipedia, respectively.

Such keyword options can only be used for Vomnibar.activate and Vomnibar.activateInNewTab.

Google site search

Choose a search engine to add to Custom search engines

gscs: javascript:location='https://www.google.com/search?num=100&q=site:'+escape(location.hostname)+'+%s'
ddgss: javascript:location='https://start.duckduckgo.com/?q=site:'+escape(location.hostname)+'+%s'

Create Vomnibar binding using mapping:

map \ Vomnibar.activate keyword=ddgss

I used \ just to test things out; of course you can use whatever you want. This will replace the current tab with the result of the running the Javascript. If you want to run in it a new tab then use:

map \ Vomnibar.activateInNewTab keyword=ddgss

Custom key mappings with a count

Custom key mappings can include a count; for example:

map d scrollDown count=5

With such a mapping (and with smooth scrolling), d-and-hold gives a faster scroll than j-and-hold.

The following open multiple links in new tabs, switching to each as it is created:

map qf LinkHints.activateModeToOpenInNewForegroundTab count=999999

Using the Escape key in inputs

Vimium uses the <Escape> key to exit insert mode. Some web sites use the <Escape> key to perform actions (like closing a window) from within inputs. For such web sites, Vimium effectively blocks the site's own functionality. One example of this is the Messenger popups used by Facebook.

The passNextKey command solves the problem.

map <c-]> passNextKey

Now, <c-]><Escape> passes the <Escape> key to the web page itself. In the case of Facebook, this closes the Messenger popup.

Muting Audio

The toggleMuteTab command mutes or unmutes the current tab. There are also two advanced forms of this command:

map X toggleMuteTab all
map Y toggleMuteTab other

In the first case, if there are any audible unmuted tabs then they are muted. Otherwise, all muted tabs are unmuted.

The second case is the same as the first, except that the current tab is excluded from consideration.

Creating Tabs with URLs and windows

The createTab command can be used to create tabs and windows with specific URLs:

map X createTab http://www.bbc.com/news
map X createTab window
map X createTab incognito
map X createTab window http://www.bbc.com/news https://twitter.com/

Swapping global and local marks

In Vim, upper-case letters are global marks, whereas lower-case letters are local marks.

In a browser, global marks are arguably more useful than local marks. Therefore, Vimium allows you to swap these two:

map X Marks.activateCreateMode swap
map Y Marks.activateGotoMode swap

With these mappings, lower-case letters are taken to be global marks, and vice versa.

Disabling Pass Keys

On sites like GMail, it is common to set pass keys in order to use the page's own keyboard shortcuts. This makes Vimium's bindings inaccessible.

The passNextKey command can also be used to re-enter Vimium's normal mode, but without any pass keys defined:

# Execute just one Vimium normal-mode command.
map \ passNextKey normal

# Execute many Vimium normal-mode commands.
map <c-}> passNextKey normal count=999999

Key Mapping

In the Custom key mappings input on the options page, you can also do key translation (for some modes).

Key translation applies to normal mode, visual mode and the detection of Escape (for all modes).

# Apparently, this works better on Brazilian keyboards.  When "ç" is entered,
# it is treated as "l":
mapkey ç l

# Add an additional mapping for Escape:
mapkey <c-c> <c-[>

# Disable <c-[>:
mapkey <c-[> <anyOldJunk>

Only single-key mappings are supported.

Hard Reload

The reload command can be used to request that the cache be bypassed:

map R reload hard

Move this tab to end/first

Move current tab to rightmost (or leftmost)

map <a-,> moveTabLeft count=99
map <a-.> moveTabRight count=99

Have nextTab and previousTab command work on all pages, even restricted ones

[philc] Unfortunately, Vimium can't run on some tabs (see the FAQ). So, if you switch to one of these disabled tabs while cycling through your tabs, Vimium's tab switching shortcuts will not work, and you'll have to use the browser's tab-switching shortcut to move off of that disabled tab.

To avoid this problem, I use a system-wide shortcut for switching tabs, so that the shortcuts work in all apps which use tabs: all browsers, terminal, text editors. On Mac, I do this with Karabiner Elements with this configuration. This remaps cmd-j to cmd-opt-leftArrow and cmd-k to cmd-opt-rightArrow, which are the tab-switching shortcut used by most MacOS apps. If an app uses a different shortcut for switching tabs, I rebind that app's shortcut to be cmd-opt-leftArrow (howto article).