2 This is part of the VimFx documentation.
3 Copyright Simon Lydell 2015, 2016.
4 See the file README.md for copying conditions.
9 VimFx has many options that can be configured, but they all have nice defaults
10 so you shouldn’t need to.
12 Advanced users might also be interested in [styling] VimFx and writing a [config
16 [config file]: config-file.md
21 These options are available in VimFx’s settings page in the Add-ons Manager
22 (where you can also customize [keyboard shortcuts]).
24 [keyboard shortcuts]: shortcuts.md
28 The characters used for the hints in Hints mode, which can be entered using one
29 of the many [hint commands].
31 Quick suggestion: Put more easily reachable keys longer to the left. Put two
32 pretty good (but not the best) keys at the end, after the space.
34 Some hint characters are easier to type than others. Many people think that the
35 ones on the home row are the best. VimFx favors keys to the left. That’s why you
36 should put better keys longer to the left.
38 The hint characters always contain a single space. This splits them into two
39 groups: _primary_ hint characters (before the space), and _secondary_ hint
40 characters (after the space). Read on to find out why.
42 Some markable elements are quicker to find than others. Therefore, VimFx looks
43 for markable elements in two passes for some commands, such as the `f` command.
44 (This is why all hints don’t always appear on screen at the same time). If two
45 passes are used, hints from the _first_ pass can only begin with _primary_ hint
46 characters. In all other cases hints may start with _any_ hint character.
48 When choosing how many secondary hint characters you want (there are two by
49 default), think about this: Usually most markable elements are found in the
50 first pass, while fewer are found in the second pass. So it makes sense to have
51 more primary hint characters than secondary. It’s a tradeoff. If you think the
52 hints from the first pass are too long, you probably need more primary hint
53 characters. On the other hand, if you think the hints from the _second_ pass are
54 too long, you might need a few extra secondary hint characters, but remember
55 that it might be at the expense of longer hints in the first pass.
57 All of this also help you understand why hints may be slow on some pages:
59 - One reason could be that most hints come from a second pass, which are slower
60 to compute (and are worse than first pass hints).
62 If a site gets an unusual amount of second pass hints, it might be because the
63 site is badly coded accessibility-wise. If so, consider contacting the site
64 and telling them so, which improves their accessibility for everyone!
66 - Another reason could be that a page has a _huge_ amount of links. If that
67 bothers you regularly, feel free to send a pull request with faster code!
69 [hint commands]: commands.md#the-hint-commands--hints-mode
71 ### “Previous”/“Next” link patterns
73 Space separated lists of patterns that match links to the previous/next page.
74 Used by the `[` and `]` commands.
76 There is a standardized way for websites to tell browsers the URLs to the
77 previous and next page. VimFx looks for that information in the first place.
78 Unfortunately, many websites don’t provide this information. Then VimFx falls
79 back on looking for links on the page that seem to go to the previous/next page
82 The patterns are matched at the beginning and end of link text (and the
83 attributes defined by the advanced setting [`pattern_attrs`]). The patterns do
84 not match in the middle of words, so “previous” does not match “previously”.
85 The matching is case <strong>in</strong>sensitive.
87 Actually, the patterns are regular expressions. If you do not know what a
88 regular expression is, that’s fine. You can type simple patterns like the
89 default ones without problems. If you do know what it is, though, you have the
90 possibility to create more advanced patterns if needed.
92 Some of the default patterns are English words. You might want to add
93 alternatives in your own language.
95 Note: If you need to include a space in your pattern, use `\s`. For example:
98 [`pattern_attrs`]: #pattern_attrs
102 Space separated list of URL patterns where VimFx should automatically enter
103 Ignore mode. Example:
105 *example.com* http://example.org/editor/*
107 The fastest way to blacklist the page you’re currently on, is to use the `gB`
108 command. It opens a modal with a text input filled in with the blacklist, and
109 with `*currentdomain.com*` added at the start for you! Edit it if needed, or
110 just press `<enter>` straight away to save. Ignore mode is then automatically
111 entered (if the URL patterns apply).
113 Note that the URLs in the list must match the current URL _entirely_ for it to
114 apply. Therefore it is easiest to always use the `*` wildcard (which matches
115 zero or more characters).
117 Set the option to `*` to make VimFx start out in Ignore mode _everywhere._
119 When you’re done editing the blacklist, go to one of the pages you intend to
120 match. If you already have a tab open for that page, reload it. Then look at
121 VimFx’s [button] to see if your edits work out.
123 Note that when Ignore mode is automatically entered because of the blacklist, it
124 is also automatically exited (returning to Normal mode) if you go to a
125 non-blacklisted page in the same tab. On the other hand, if you entered Ignore
126 mode by pressing `i`, you’ll stay in Ignore mode in that tab until you exit it,
127 even if you navigate to another page.
129 You might also want to read about the [Ignore mode `<s-f1>` command][s-f1].
132 [s-f1]: commands.md#ignore-mode-s-f1
134 #### Blacklisting specific elements
136 VimFx automatically enters Ignore mode while Vim-style editors are focused, such
137 as the [wasavi] extension and [CodeMirror editors in Vim mode][codemirror-vim].
139 By default, VimFx lets you press `<escape>` to blur text inputs. Also by
140 default, Vim-style editors use `<escape>` to exit from their Insert mode to
141 their Normal mode. In other words, there is a keyboard shortcut conflict here.
143 It makes the most sense to let the Vim-style editor “win.” That’s why VimFx
144 (temporarily) enters Ignore mode when focusing such an editor. In Ignore mode,
145 there is no `<escape>` shortcut (by default), and thus no conflict. Instead,
146 there’s `<s-escape>` to blur the current element and exit Ignore mode.
147 `<s-escape>` was chosen because it is very unlikely to cause conflicts. If it
148 ever does, there’s the [`<s-f1>`] command to the rescue.
150 There is currently no way of specifying your own elements to be blacklisted, but
151 such a feature could be added if there’s demand for it.
153 [wasavi]: http://appsweets.net/wasavi/
154 [codemirror-vim]: https://codemirror.net/demo/vim.html
155 [`<s-f1>`]: commands.md#ignore-mode-s-f1
157 ### Prevent autofocus
159 Many sites autofocus their search box, for example. This might be annoying when
160 browsing using the keyboard, as you do with VimFx, because it often feels like
161 VimFx isn’t responding, until you realize that you are typing in a text box—not
162 running VimFx commands!
164 For this reason VimFx can prevent autofocus. It’s not enabled by default,
165 though, since one of VimFx’s key features is to be nice to your browser and your
168 If enabled, all focusing that occurs on page load, or after you’ve just switched
169 back to a tab from another, until you interact with the page is prevented.
171 #### Technical notes and trivia
173 Autofocus on page load and when coming back to a tab are the two most common
174 cases. Some sites, though, automatically focus a text input in other cases as
175 well. Trying to catch those cases as well, VimFx used to prevent all focusing
176 that didn’t occur within a fixed number of milliseconds after your last
177 interaction (click or keypress). However, this proved to be too aggressive,
178 preventing too much focusing. In other words, the time-based check was not
179 sufficient to distinguish between intended focusing and automatic unwanted
180 focusing. It made things worse more than it helped. Since these cases are so
181 difficult (if not impossible) to detect, it is better to leave them. Thankfully
182 they are not very common.
184 On page load or when coming back to a tab, before you have interacted with the
185 page in any way, we can be _sure_ that any focusing is automatic (not caused by
186 you), which makes it safe to prevent all focusing in those time spans.
188 ### Ignore keyboard layout
190 If you use more than one keyboard layout, you probably want to enable this
193 People who use a keyboard layout _without_ the letters A–Z usually also use the
194 standard en-US QWERTY layout as well.
196 This option makes VimFx ignore your current layout and pretend that the standard
197 en-US QWERTY layout is _always_ used. This way the default shortcuts work even
198 if your layout doesn’t contain the letters A–Z and all shortcuts can be typed by
199 the same physical keys on your keyboard regardless of your current keyboard
202 (If you’d like VimFx to pretend that some other keyboard layout than the
203 standard en-US QWERTY is always used, you may do so with the special option
206 [`translations`]: #translations
210 The maximum amount of time (in milliseconds) that may pass between two
211 keypresses of a shortcut.
213 It’s easy to press, say, `a` by mistake while browsing. Without a timeout, you
214 might be surprised that all search results are highlighted when you a bit later
215 try to search using the `/` command. (That’s what `a/` does.) _With_ a timeout,
216 the `a` would be cancelled when the timeout has passed.
221 These options are _not_ available in VimFx’s settings page in the Add-ons
222 Manager. They can only be changed in [about:config] or using a [config file].
223 They all start with `extensions.VimFx.`.
225 (There are actually a few more advanced options than those listed here. You can
226 see them all in [defaults.coffee].)
228 [about:config]: http://kb.mozillazine.org/About:config
229 [config file]: config-file.md
230 [defaults.coffee]: ../extension/lib/defaults.coffee
232 ### `notifications_enabled`
234 Controls whether [notifications] should be shown or not.
236 You can also choose to show notifications any way you want by listening for the
237 [the `notification` and `hideNotification` events][notification-events].
239 [notifications]: notifications.md
240 [notification-events]: api.md#the-notification-and-hidenotification-events
242 ### `notify_entered_keys`
244 If enabled, a [notification] is shown with the keys you have entered so far of
245 a command. This is only noticeable if you type a multi-key shortcut or use a
248 [notification]: notifications.md
250 ### `prevent_target_blank`
252 You might have noticed that some links open in new tabs when you click them.
253 That is not the case if you “click” them using VimFx’s `f` command, though. If
254 you dislike that, disable this option.
258 Controls whether [counts] are enabled or not.
260 [counts]: commands.md#counts
262 ### `find_from_top_of_viewport`
264 Toggles whether the various find commands are Vim-style or Firefox
267 Disable this pref if you want `/` to work more like `<c-f>` and `n`/`N` to work
268 more like `<f3>`/`<s-f3>`.
270 If there is selected text on the page, Firefox starts searching after that.
271 VimFx does so too, but only if the selection is currently _visible_ (inside the
274 If there _isn’t_ selected text on the page, Firefox starts searching from the
275 top of the page. VimFx instead starts searching from the top of the current
278 The VimFx behavior is designed to be less disorienting. It is also similar to
279 how searching in Vim works. Again, you can return to the Firefox default
280 behavior (if you prefer that) by disabling this pref.
282 One of the main benefits of the VimFx behavior is that you can scroll past a
283 block of the text with lots of search matches and then continue going through
284 matches with `n` after that block, without having to spam `n` lots and lots of
287 ### `ignore_ctrl_alt`
289 This option is enabled by default on Windows, and disabled otherwise.
291 If enabled, ignores ctrl+alt for printable keys. `<a-c-$>` becomes `$` and
292 `<a-c-A>` becomes `A`, while `<a-c-enter>` stays the same.
294 This option is suitable on Windows, which treats [AltGr as
295 ctrl+alt][wikipedia-altgr]. For example, if a user of the sv-SE layout on
296 Windows holds AltGr and presses the key labeled `4`, in order to produce a `$`,
297 the result would be `<a-c-$>` without this option, making it impossible to
298 trigger a keyboard shortcut containing `$`. _With_ this option the result is
299 `$`, as expected (and as on GNU/Linux). On the other hand it won’t be possible
300 to trigger keyboard shortcuts such as `<a-c-a>`, but ctrl+alt keyboard shortcuts
301 are [discouraged on Windows][wikipedia-altgr] anyway because of this reason.
303 [wikipedia-altgr]: https://en.wikipedia.org/wiki/AltGr_key#Control_.2B_Alt_as_a_substitute
305 ### `prevent_autofocus_modes`
307 Space separated list of modes where `prevent_autofocus` should be used.
309 ### `config_file_directory`
311 VimFx can optionally be customized using a [config file]. If you want to that,
312 you need to tell VimFx where that file is. That’s what this pref is for.
314 By default this pref is blank (the empty string), which means that no config
315 file should be loaded.
317 If non-blank, it should be the path to the directory where the config file
318 exists. See the [config file] documentation for more information.
320 [config file]: config-file.md
324 The number of milliseconds VimFx should wait after an element has been blurred
325 before checking if you’re inside a text input or not.
327 Some sites with fancy text inputs (such as twitter) blur the text input for a
328 split second and then re-focus it again while typing (for some reason). If you
329 happen to press a key during that split second, that key might trigger a VimFx
330 shortcut instead of typing into the text input, which can be quite annoying. To
331 avoid the problem, VimFx waits a bit before checking if you have left the text
336 The number of milliseconds a matched hint marker should stay on screen before
337 disappearing (or resetting).
341 In Hints mode, VimFx continually checks if the element for a hint marker has
342 moved. If so, the marker is moved as well. This pref controls how many
343 milliseconds VimFx should “sleep” between each check. The shorter, the more CPU
344 usage, the longer, the more stuttery marker movement.
346 The default value should work fine, but if you have a low-performing computer
347 and you notice bothering CPU usage during Hints mode you might want to raise the
350 Set it to -1 to disable the marker movement feature entirely.
354 Apart from its own prefs, VimFx also respects a few built-in Firefox prefs.
356 #### Smooth scrolling
358 If you want to customize Firefox’s smooth scrolling, adjusting
359 `general.smoothScroll.{lines,pages,other}.duration{Min,Max}MS` is the way to
360 go. VimFx has similar prefs for the scrolling commands, but they work like
361 `layout.css.scroll-behavior.spring-constant`.
363 Basically, the higher the value, the faster the scrolling.
365 These are VimFx’s variants, and the commands they affect:
367 - `smoothScroll.lines.spring-constant`: `h`, `l`, `j`, `k`
368 - `smoothScroll.pages.spring-constant`: `d`, `u`, `<space>`, `<s-space>`
369 - `smoothScroll.other.spring-constant`: `gg`, `G`, `0`, `^`, `$`, `'`
371 Note that the value of these prefs are _strings,_ not numbers!
373 Unfortunately, Firefox provides no way for code to tell which “spring constant”
374 it wants when scrolling smoothly. All VimFx can do is to temporarily set
375 Firefox’s `layout.css.scroll-behavior.spring-constant` pref. It is reset again
376 after one second (by default). If that doesn’t work out for you, you can
377 customize that timeout using the `scroll.reset_timeout` pref.
379 The Firefox pref `general.smoothScroll` lets you turn off smooth scrolling
380 entirely, including all of VimFx’s scrolling commands.
382 `general.smoothScroll.lines`, `general.smoothScroll.pages`, and
383 `general.smoothScroll.other` lets you selectively disable smooth scrolling.
384 VimFx’s scrolling commands follow the same “lines,” “pages” and “other”
385 categorization as in the above list.
389 By default you can scroll using the arrow keys in Firefox. You can control how
390 much they scroll by adjusting the following prefs:
392 - `toolkit.scrollbox.horizontalScrollDistance`: `<left>`, `<right>`, `h`, `l`
393 - `toolkit.scrollbox.verticalScrollDistance`: `<down>`, `<up>`, `j`, `k`
395 (VimFx used to have a `scroll_step` pref, but is has been replaced by the
398 #### `scroll.full_page_adjustment` and `scroll.half_page_adjustment`
400 An important use case for scrolling a full page down is to read an entire page
401 (a window-full) of text, press `<space>` and then continue reading the next
402 page. However, if you can only see, say, _half_ of the height the last line,
403 pressing `<space>` would give you the other half, but reading only the top or
404 bottom parts of letters is difficult. Even if the lines happen to line up with
405 the window edge to not be sliced horizontally, it might feel disorienting
408 For this reason, both VimFx and Firefox by default scroll _about a line less
409 than a whole page_ when pressing `<space>`. This solves the sliced-last-line
410 problem, and provides some context on where you are in the text you’re reading.
412 These two prefs control how many pixels “about a line” actually means for the
413 different page scrolling commands.
415 - `scroll.full_page_adjustment`: `<space>, `<s-space>`
416 - `scroll.half_page_adjustment`: `d`, `u`
418 #### `scroll.last_position_mark`
420 The special mark for the [`'`][scroll-to-mark] command that takes you to the
423 [scroll-to-mark]: commands.md#marks-m-and-
425 ### `pattern_selector`
427 A CSS selector that targets candidates for a previous/next page link.
431 A space-separated list of attributes that the [“Previous”/“Next” link patterns]
432 should be matched against.
434 [“Previous”/“Next” link patterns]: #previousnext-link-patterns
436 ### `hints_peek_through`
438 This pref doesn’t do much. If you’ve used custom [styling] to change which
439 modifier lets you peek through markers in [Hints mode], you might want to change
440 this pref as well. Otherwise VimFx’s Keyboard Shortcuts dialog will still tell
441 you to press shift for this task.
443 [styling]: styling.md
444 [Hints mode]: commands.md#the-hint-commands--hints-mode
446 ### `hints_toggle_in_tab`
448 If the keypress that matched a hint starts with this string, toggle whether to
449 open the matched link in the current tab or a new tab. See the [hint commands]
450 for more information.
452 ### `hints_toggle_in_background`
454 If the keypress that matched a hint starts with this string, open the matched
455 link in a new tab and toggle whether to open that tab in the background or
456 foreground. See the [hint commands] for more information.
458 ### `activatable_element_keys`
460 Keys that should not trigger VimFx commands but be sent through to the page if
461 an “activatable” element (link or button) is focused.
463 ### `adjustable_element_keys`
465 Keys that should not trigger VimFx commands but be sent through to the page if
466 an “adjustable” element (form control or video player) is focused.
468 ### `focus_previous_key` and `focus_next_key`
470 The default values are `<s-tab` and `<tab>`, respectively. Those keys are
471 specially handled after focusing a text input using [`gi`]. To disable this
472 special handling, set the prefs to the empty string.
474 [`gi`]: commands.md#gi-1
479 These options are available in neither VimFx’s settings page in the Add-ons
480 Manager nor in [about:config]. The only way to change them is by using the
485 See the description of the `translations` option in [vim-like-key-notation].
487 [vim-like-key-notation]: https://github.com/lydell/vim-like-key-notation#api
491 See the documentation for [`vimfx.get('categories')`][categories].
493 [categories]: api.md#vimfxgetcategories