]> git.gir.st - VimFx.git/blob - documentation/options.md
VimFx v0.27.1
[VimFx.git] / documentation / options.md
1 # Options
2
3 VimFx has many options that can be configured, but they all have nice defaults
4 so you shouldn’t need to.
5
6 Advanced users might also be interested in [styling] VimFx and writing a [config
7 file].
8
9 [styling]: styling.md
10 [config file]: config-file.md
11
12
13 ## Regular options
14
15 These options are available in VimFx’s options page in the Add-ons Manager
16 (where you can also customize [keyboard shortcuts]).
17
18 [keyboard shortcuts]: shortcuts.md
19
20 ### Prevent autofocus
21
22 `prevent_autofocus`
23
24 Many sites autofocus their search box, for example. This might be annoying when
25 browsing using the keyboard, as you do with VimFx, because it often feels like
26 VimFx isn’t responding, until you realize that you are typing in a text box—not
27 running VimFx commands!
28
29 For this reason VimFx can prevent autofocus. It’s not enabled by default,
30 though, since one of VimFx’s key features is to be nice to your browser and your
31 habits.
32
33 If enabled, all focusing that occurs on page load, or after you’ve just switched
34 back to a tab from another, until you interact with the page is prevented.
35
36 #### Technical notes and trivia
37
38 Autofocus on page load and when coming back to a tab are the two most common
39 cases. Some sites, though, automatically focus a text input in other cases as
40 well. Trying to catch those cases as well, VimFx used to prevent all focusing
41 that didn’t occur within a fixed number of milliseconds after your last
42 interaction (click or keypress). However, this proved to be too aggressive,
43 preventing too much focusing. In other words, the time-based check was not
44 sufficient to distinguish between intended focusing and automatic unwanted
45 focusing. It made things worse more than it helped. Since these cases are so
46 difficult (if not impossible) to detect, it is better to leave them. Thankfully
47 they are not very common.
48
49 On page load or when coming back to a tab, before you have interacted with the
50 page in any way, we can be _sure_ that any focusing is automatic (not caused by
51 you), which makes it safe to prevent all focusing in those time spans.
52
53 ### Ignore keyboard layout
54
55 `ignore_keyboard_layout`
56
57 If you use more than one keyboard layout, you probably want to enable this
58 option.
59
60 People who use a keyboard layout _without_ the letters A–Z usually also use the
61 standard en-US QWERTY layout as well.
62
63 This option makes VimFx ignore your current layout and pretend that the standard
64 en-US QWERTY layout is _always_ used. This way the default shortcuts work even
65 if your layout doesn’t contain the letters A–Z and all shortcuts can be typed by
66 the same physical keys on your keyboard regardless of your current keyboard
67 layout.
68
69 Note that when filtering hints markers by element text (but not when typing hint
70 characters) in [Hints mode], your current layout _is_ used, even if you’ve
71 enabled ignoring of it. That’s because otherwise you wouldn’t be able to filter
72 by element text in any other language than English.
73
74 If you have modified your keyboard layout slightly using software, such as
75 having swapped `<capslock>` and `<escape>`, this option will cause VimFx to
76 ignore that as well. If that’s unwanted, you need to tell VimFx about your
77 layout customizations by using the special option [`translations`].
78
79 If you’d like VimFx to pretend that some other keyboard layout than the standard
80 en-US QWERTY is always used, that’s also a job for the special option
81 [`translations`].
82
83 [Hints mode]: commands.md#the-hint-commands--hints-mode
84 [`translations`]: #translations
85
86 ### Blacklist
87
88 `blacklist`
89
90 Space separated list of URL patterns where VimFx should automatically enter
91 Ignore mode. Example:
92
93 *example.com* http://example.org/editor/*
94
95 **The fastest way** to blacklist the page you’re currently on, is to **use the
96 `gB` command.** It opens a modal with a text input filled in with the blacklist,
97 and with `*currentdomain.com*` added at the start for you! Edit it if needed, or
98 just press `<enter>` straight away to save. Ignore mode is then automatically
99 entered (if the URL patterns apply).
100
101 Note that the URLs in the list must match the current URL _entirely_ for it to
102 apply. Therefore it is easiest to always use the `*` wildcard (which matches
103 zero or more characters).
104
105 Set the option to `*` to make VimFx start out in Ignore mode _everywhere._
106
107 When you’re done editing the blacklist, go to one of the pages you intend to
108 match. If you already have a tab open for that page, reload it. Then look at
109 VimFx’s [button] to see if your edits work out.
110
111 Note that when Ignore mode is automatically entered because of the blacklist, it
112 is also automatically exited (returning to Normal mode) if you go to a
113 non-blacklisted page in the same tab. On the other hand, if you entered Ignore
114 mode by pressing `i`, you’ll stay in Ignore mode in that tab until you exit it,
115 even if you navigate to another page.
116
117 You might also want to read about the [Ignore mode `<s-f1>` command][s-f1].
118
119 [button]: button.md
120 [s-f1]: commands.md#ignore-mode-s-f1
121
122 #### Blacklisting specific elements
123
124 VimFx automatically enters Ignore mode while Vim-style editors are focused, such
125 as the [wasavi] extension and [CodeMirror editors in Vim mode][codemirror-vim].
126
127 By default, VimFx lets you press `<escape>` to blur text inputs. Also by
128 default, Vim-style editors use `<escape>` to exit from their Insert mode to
129 their Normal mode. In other words, there is a keyboard shortcut conflict here.
130
131 It makes the most sense to let the Vim-style editor “win.” That’s why VimFx
132 (temporarily) enters Ignore mode when focusing such an editor. In Ignore mode,
133 there is no `<escape>` shortcut (by default), and thus no conflict. Instead,
134 there’s `<s-escape>` to blur the current element and exit Ignore mode.
135 `<s-escape>` was chosen because it is very unlikely to cause conflicts. If it
136 ever does, there’s the [`<s-f1>`] command to the rescue.
137
138 There is currently no way of specifying your own elements to be blacklisted, but
139 such a feature could be added if there’s demand for it.
140
141 [wasavi]: http://appsweets.net/wasavi/
142 [codemirror-vim]: https://codemirror.net/demo/vim.html
143 [`<s-f1>`]: commands.md#ignore-mode-s-f1
144
145 ### Hint characters
146
147 `hints.chars`
148
149 The characters used for the hints in Hints mode, which can be entered using one
150 of the many [hint commands].
151
152 **Tip:** Prefer filtering hints by element text? Use only uppercase hint
153 characters (such as `FJDKSLAGHRUEIWONC MV`), or only numbers (`01234567 89`).
154
155 [hint commands]: commands.md#the-hint-commands--hints-mode
156
157 #### Filtering hints by element text
158
159 All characters other than the hint characters are used to filter hint markers by
160 element text.
161
162 The filtering works like in Firefox’s location bar. In short, that means:
163
164 - It is case insensitive.
165 - Your typed characters are split on spaces. Each part must be present in the
166 element text (in any order, and they may overlap).
167
168 By default, “f” is a hint character. If you type an “f”, that character is used
169 to match the hints on screen. If you type an “F” (uppercase), though, which is
170 _not_ a hint character by default, you will filter the hints based on element
171 text, causing some hints markers to disappear, and the rest to be replaced. Only
172 the markable elements with text containing an “f” or “F” will now get a hint
173 marker. All the “f”s and “F”s are highlighted on the page, to help you keep
174 track of what’s going on. Keep typing other non-hint characters to further
175 reduce the number of hint markers, and make the hints shorter all the time.
176
177 Hint markers are usually displayed in uppercase, because it looks nicer.
178 However, if you mix both lowercase and uppercase hint characters, they will be
179 displayed as-is, so you can tell them apart. It is recommended to either use
180 _only_ lowercase or _only_ uppercase characters, though.
181
182 Some people prefer to filter hint markers by element text in the first hand,
183 rather than typing hint characters. If so, it is a good idea to choose all
184 uppercase hint characters, or only numbers. This way, you can press `f` and then
185 simply begin typing the text of the link you wish to follow.
186
187 #### Easy-to-type and performant hints
188
189 Quick suggestion: Put more easily reachable keys longer to the left. Put two
190 pretty good (but not the best) keys at the end, after the space.
191
192 Some hint characters are easier to type than others. Many people think that the
193 ones on the home row are the best. VimFx favors keys to the left. That’s why you
194 should put better keys longer to the left.
195
196 The hint characters always contain a single space. This splits them into two
197 groups: _primary_ hint characters (before the space), and _secondary_ hint
198 characters (after the space). Read on to find out why.
199
200 Some markable elements are quicker to find than others. Therefore, VimFx looks
201 for markable elements in two passes for some commands, such as the `f` command.
202 (This is why all hints don’t always appear on screen at the same time). If two
203 passes are used, hints from the _first_ pass can only begin with _primary_ hint
204 characters. In all other cases hints may start with _any_ hint character.
205
206 When choosing how many secondary hint characters you want (there are two by
207 default), think about this: Usually most markable elements are found in the
208 first pass, while fewer are found in the second pass. So it makes sense to have
209 more primary hint characters than secondary. It’s a tradeoff. If you think the
210 hints from the first pass are too long, you probably need more primary hint
211 characters. On the other hand, if you think the hints from the _second_ pass are
212 too long, you might need a few extra secondary hint characters, but remember
213 that it might be at the expense of longer hints in the first pass.
214
215 All of this also help you understand why hints may be slow on some pages:
216
217 - One reason could be that most hints come from a second pass, which are slower
218 to compute (and are worse than first pass hints).
219
220 If a site gets an unusual amount of second pass hints, it might be because the
221 site is badly coded accessibility-wise. If so, consider contacting the site
222 and telling them so, which improves their accessibility for everyone!
223
224 - Another reason could be that a page has a _huge_ amount of links. If that
225 bothers you regularly, feel free to send a pull request with faster code!
226
227 ### Hint auto-activation
228
229 `hints.auto_activate`
230
231 The marker (or marker<strong>s</strong> in the case where several links go to
232 the same place and have gotten the same hint) with the best hint are highlighted
233 with a different color. You may at any time press `<enter>` to activate those
234 markers.
235
236 One workflow is to type non-hint characters until the hint marker of the element
237 you want to activate gets highlighted, and then hit `<enter>`. To make this more
238 obvious, the entire element text is selected, too. However, if _all_ hint
239 markers end up highlighted (because the text you’ve typed uniquely identifies a
240 single link) the highlighted markers will be activated _automatically._
241
242 If you dislike that, disable this option. Then, you either have to press
243 `<enter>` or a hint character to activate hint markers.
244
245 ### Auto-activation timeout
246
247 `hints.timeout`
248
249 If you type quickly, you might find that you will keep typing even after a hint
250 marker has been automatically activated (see [Hint auto-activation]). You might
251 simply not react that quickly. This might cause you to accidentally trigger
252 VimFx commands. Therefore, VimFx ignores all your keypresses for a certain
253 number of milliseconds when having automatically activated a hint marker after
254 filtering by element text. This option controls exactly how many milliseconds
255 that is.
256
257 If you can’t find a timeout that works for you, you might want to disable [Hint
258 auto-activation] instead.
259
260 [Hint auto-activation]: #hint-auto-activation
261
262 ### Timeout
263
264 `timeout`
265
266 The maximum amount of time (in milliseconds) that may pass between two
267 keypresses of a shortcut.
268
269 It’s easy to press, say, `a` by mistake while browsing. Without a timeout, you
270 might be surprised that all search results are highlighted when you a bit later
271 try to search using the `/` command. (That’s what `a/` does.) _With_ a timeout,
272 the `a` would be cancelled when the timeout has passed.
273
274 ### “Previous”/“Next” link patterns
275
276 `prev_patterns`/`next_patterns`
277
278 Space separated lists of patterns that match links to the previous/next page.
279 Used by the `[` and `]` commands.
280
281 There is a standardized way for websites to tell browsers the URLs to the
282 previous and next page. VimFx looks for that information in the first place.
283 Unfortunately, many websites don’t provide this information. Then VimFx falls
284 back on looking for links on the page that seem to go to the previous/next page
285 using patterns.
286
287 The patterns are matched at the beginning and end of link text (and the
288 attributes defined by the advanced option [`pattern_attrs`]). The patterns do
289 not match in the middle of words, so “previous” does not match “previously”.
290 The matching is case <strong>in</strong>sensitive.
291
292 Actually, the patterns are regular expressions. If you do not know what a
293 regular expression is, that’s fine. You can type simple patterns like the
294 default ones without problems. If you do know what it is, though, you have the
295 possibility to create more advanced patterns if needed.
296
297 Some of the default patterns are English words. You might want to add
298 alternatives in your own language.
299
300 Note: If you need to include a space in your pattern, use `\s`. For example:
301 `next\spage`.
302
303 [`pattern_attrs`]: #pattern_attrs
304
305
306 ## Advanced options
307
308 These options are _not_ available in VimFx’s options page in the Add-ons
309 Manager. They can only be changed in [about:config] or using a [config file].
310 They all start with `extensions.VimFx.`.
311
312 Don’t feel that you have to go through all of these options in order to get the
313 most from VimFx! Really, there’s no need at all to change the defaults unless
314 you’ve run into some edge case.
315
316 (There are actually a few more advanced options than those listed here. You can
317 see them all in [defaults.coffee].)
318
319 [about:config]: http://kb.mozillazine.org/About:config
320 [config file]: config-file.md
321 [defaults.coffee]: ../extension/lib/defaults.coffee
322
323 ### `notifications_enabled`
324
325 Controls whether [notifications] should be shown or not.
326
327 You can also choose to show notifications any way you want by listening for the
328 [the `notification` and `hideNotification` events][notification-events].
329
330 [notifications]: notifications.md
331 [notification-events]: api.md#the-notification-and-hidenotification-events
332
333 ### `notify_entered_keys`
334
335 If enabled, a [notification] is shown with the keys you have entered so far of
336 a command. This is only noticeable if you type a multi-key shortcut or use a
337 count, or if you filter hint markers by element text (then, the text you’ve
338 typed will be shown).
339
340 [notification]: notifications.md
341
342 ### `prevent_target_blank`
343
344 You might have noticed that some links open in new tabs when you click them.
345 That is not the case if you “click” them using VimFx’s `f` command, though. If
346 you dislike that, disable this option.
347
348 ### `counts_enabled`
349
350 Controls whether [counts] are enabled or not.
351
352 [counts]: commands.md#counts
353
354 ### `find_from_top_of_viewport`
355
356 Toggles whether the various find commands are Vim-style or Firefox
357 default-style.
358
359 Disable this option if you want `/` to work more like `<c-f>` and `n`/`N` to
360 work more like `<f3>`/`<s-f3>`.
361
362 If there is selected text on the page, Firefox starts searching after that.
363 VimFx does so too, but only if the selection is currently _visible_ (inside the
364 current viewport).
365
366 If there _isn’t_ selected text on the page, Firefox starts searching from the
367 top of the page. VimFx instead starts searching from the top of the current
368 viewport.
369
370 The VimFx behavior is designed to be less disorienting. It is also similar to
371 how searching in Vim works. Again, you can return to the Firefox default
372 behavior (if you prefer that) by disabling this option.
373
374 One of the main benefits of the VimFx behavior is that you can scroll past a
375 block of the text with lots of search matches and then continue going through
376 matches with `n` after that block, without having to spam `n` lots and lots of
377 times.
378
379 ### `browsewithcaret`
380
381 [Caret mode] uses [Firefox’s own Caret mode] under the hood. This means that
382 VimFx temporarily enables the Firefox option `accessibility.browsewithcaret`
383 when you are in VimFx’s Caret mode. When you leave Caret mode, that option is
384 turned off again.
385
386 VimFx automatically syncs the `browsewithcaret` option with
387 `accessibility.browsewithcaret`. If you change the latter manually (such as by
388 using the Firefox default shortcut `<f7>`), VimFx’s option is changed as well,
389 so you shouldn’t really have to touch this option at all.
390
391 [Caret mode]: commands.md#caret-mode
392 [Firefox’s own Caret mode]: http://kb.mozillazine.org/Accessibility_features_of_Firefox#Allow_text_to_be_selected_with_the_keyboard
393
394 ### `ignore_ctrl_alt`
395
396 This option is enabled by default on Windows, and disabled otherwise.
397
398 If enabled, ignores ctrl+alt for printable keys. `<a-c-$>` becomes `$` and
399 `<a-c-A>` becomes `A`, while `<a-c-enter>` stays the same.
400
401 This option is suitable on Windows, which treats [AltGr as
402 ctrl+alt][wikipedia-altgr]. For example, if a user of the sv-SE layout on
403 Windows holds AltGr and presses the key labeled `4`, in order to produce a `$`,
404 the result would be `<a-c-$>` without this option, making it impossible to
405 trigger a keyboard shortcut containing `$`. _With_ this option the result is
406 `$`, as expected (and as on GNU/Linux). On the other hand it won’t be possible
407 to trigger keyboard shortcuts such as `<a-c-a>`, but ctrl+alt keyboard shortcuts
408 are [discouraged on Windows][wikipedia-altgr] anyway because of this reason.
409
410 [wikipedia-altgr]: https://en.wikipedia.org/wiki/AltGr_key#Ctrl.2BAlt
411
412 ### `prevent_autofocus_modes`
413
414 Space separated list of modes where `prevent_autofocus` should be used.
415
416 ### `config_file_directory`
417
418 VimFx can optionally be customized using a [config file]. If you want to that,
419 you need to tell VimFx where that file is. That’s what this option is for.
420
421 By default this option is blank (the empty string), which means that no config
422 file should be loaded.
423
424 If non-blank, it should be the path to the directory where the config file
425 exists. See the [config file] documentation for more information.
426
427 [config file]: config-file.md
428
429 ### `blur_timeout`
430
431 The number of milliseconds VimFx should wait after an element has been blurred
432 before checking if you’re inside a text input or not.
433
434 Some sites with fancy text inputs (such as twitter) blur the text input for a
435 split second and then re-focus it again while typing (for some reason). If you
436 happen to press a key during that split second, that key might trigger a VimFx
437 shortcut instead of typing into the text input, which can be quite annoying. To
438 avoid the problem, VimFx waits a bit before checking if you have left the text
439 input.
440
441 ### `refocus_timeout`
442
443 If you switch to another window while a text input is focused, Firefox actually
444 blurs the text input. If you then switch back again, Firefox will re-focus the
445 text input.
446
447 VimFx tracks that case, so that the [Prevent autofocus] option does not think it
448 should prevent that refocus. Unfortunately, the tracking requires a timeout.
449 This option let’s you customize that timeout (measured in milliseconds).
450
451 If you experience that text input focus is lost after switching back to Firefox
452 from another window, you might want to increase this timeout.
453
454 [Prevent autofocus]: #prevent-autofocus
455
456 ### Scrolling options
457
458 Apart from its own options, VimFx also respects a few built-in Firefox options.
459
460 #### Smooth scrolling
461
462 If you want to customize Firefox’s smooth scrolling, adjusting
463 `general.smoothScroll.{lines,pages,other}.duration{Min,Max}MS` is the way to
464 go. VimFx has similar options for the scrolling commands, but they work like
465 `layout.css.scroll-behavior.spring-constant`.
466
467 Basically, the higher the value, the faster the scrolling.
468
469 These are VimFx’s variants, and the commands they affect:
470
471 - `smoothScroll.lines.spring-constant`: `h`, `l`, `j`, `k`
472 - `smoothScroll.pages.spring-constant`: `d`, `u`, `<space>`, `<s-space>`
473 - `smoothScroll.other.spring-constant`: `gg`, `G`, `0`, `^`, `$`, `'`
474
475 Note that the value of these options are _strings,_ not numbers!
476
477 Unfortunately, Firefox provides no way for code to tell which “spring constant”
478 it wants when scrolling smoothly. All VimFx can do is to temporarily set
479 Firefox’s `layout.css.scroll-behavior.spring-constant` option. It is reset again
480 after one second (by default). If that doesn’t work out for you, you can
481 customize that timeout using the `scroll.reset_timeout` option.
482
483 Another quirk of Firefox’s smooth scrolling is that it doesn’t like if you ask
484 for smooth scrolling too often: The scrolling can get stuttery, progressively
485 slower and even grind to a halt. On a long page with lots of elements, simply
486 holding `d`, `u`, `<space>` or `<s-space>` can be too much. By default, keyboard
487 software typically repeats keypresses every 30ms when holding keys. Because of
488 this, VimFx only asks for smooth scrolling if more than 65ms (two repeats) has
489 passed since the last request. You can customize that timeout via the
490 `scroll.repeat_timeout` option.
491
492 The Firefox option `general.smoothScroll` lets you turn off smooth scrolling
493 entirely, including all of VimFx’s scrolling commands.
494
495 `general.smoothScroll.lines`, `general.smoothScroll.pages`, and
496 `general.smoothScroll.other` lets you selectively disable smooth scrolling.
497 VimFx’s scrolling commands follow the same “lines,” “pages” and “other”
498 categorization as in the above list.
499
500 #### Scroll step
501
502 By default you can scroll using the arrow keys in Firefox. You can control how
503 much they scroll by adjusting the following options:
504
505 - `toolkit.scrollbox.horizontalScrollDistance`: `<left>`, `<right>`, `h`, `l`
506 - `toolkit.scrollbox.verticalScrollDistance`: `<down>`, `<up>`, `j`, `k`
507
508 (VimFx used to have a `scroll_step` option, but is has been replaced by the
509 above.)
510
511 #### `scroll.horizontal_boost` and `scroll.vertical_boost`
512
513 When holding down `h`, `l`, `j` or `k` (rather than just tapping those keys),
514 their scrolling speed is sped up, just like when you hold down an arrow key to
515 scroll. These options control _how much_ the mentioned commands are sped up. The
516 usual scroll distances are multiplied by these numbers.
517
518 #### `scroll.full_page_adjustment` and `scroll.half_page_adjustment`
519
520 An important use case for scrolling a full page down is to read an entire page
521 (a window-full) of text, press `<space>` and then continue reading the next
522 page. However, if you can only see, say, _half_ of the height the last line,
523 pressing `<space>` would give you the other half, but reading only the top or
524 bottom parts of letters is difficult. Even if the lines happen to line up with
525 the window edge to not be sliced horizontally, it might feel disorienting
526 pressing `<space>`.
527
528 For this reason, both VimFx and Firefox by default scroll _about a line less
529 than a whole page_ when pressing `<space>`. This solves the sliced-last-line
530 problem, and provides some context on where you are in the text you’re reading.
531
532 These two options control how many pixels “about a line” actually means for the
533 different page scrolling commands.
534
535 - `scroll.full_page_adjustment`: `<space>, `<s-space>`
536 - `scroll.half_page_adjustment`: `d`, `u`
537
538 #### `scroll.last_position_mark` and `scroll.last_find_mark`
539
540 These options allow you to customize the [special marks] for the
541 [`'`][scroll-to-mark] command.
542
543 [special marks]: commands.md#special-marks
544 [scroll-to-mark]: commands.md#marks-m-and-
545
546 ### `pattern_selector`
547
548 A CSS selector that targets candidates for a previous/next page link.
549
550 ### `pattern_attrs`
551
552 A space-separated list of attributes that the [“Previous”/“Next” link patterns]
553 should be matched against.
554
555 [“Previous”/“Next” link patterns]: #previousnext-link-patterns
556
557 ### `hints.matched_timeout`
558
559 The number of milliseconds a matched hint marker should stay on screen before
560 disappearing (or resetting).
561
562 ### `hints.sleep`
563
564 In Hints mode, VimFx continually checks if the element for a hint marker has
565 moved. If so, the marker is moved as well. This option controls how many
566 milliseconds VimFx should “sleep” between each check. The shorter, the more CPU
567 usage, the longer, the more stuttery marker movement.
568
569 The default value should work fine, but if you have a low-performing computer
570 and you notice bothering CPU usage during Hints mode you might want to raise the
571 sleep time.
572
573 Set it to -1 to disable the marker movement feature entirely.
574
575 ### `hints.match_text`
576
577 If you strongly dislike that typing non-[Hint characters] filters hint markers
578 by element text, disable this option. (That’ll make things work like it did in
579 VimFx 0.18.x and older.)
580
581 [Hint characters]: #hint-characters
582
583 ### `hints.peek_through`
584
585 This option doesn’t do much. If you’ve used custom [styling] to change which
586 modifier lets you peek through markers in [Hints mode], you might want to change
587 this option as well. Otherwise VimFx’s Keyboard Shortcuts dialog will still tell
588 you to press shift for this task.
589
590 [styling]: styling.md
591 [Hints mode]: commands.md#the-hint-commands--hints-mode
592
593 ### `hints.toggle_in_tab`
594
595 If the keypress that matched a hint starts with this string, toggle whether to
596 open the matched link in the current tab or a new tab. See the [hint commands]
597 for more information.
598
599 ### `hints.toggle_in_background`
600
601 If the keypress that matched a hint starts with this string, open the matched
602 link in a new tab and toggle whether to open that tab in the background or
603 foreground. See the [hint commands] for more information.
604
605 ### `activatable_element_keys`
606
607 Keys that should not trigger VimFx commands but be sent through to the page if
608 an “activatable” element (link or button) is focused.
609
610 ### `adjustable_element_keys`
611
612 Keys that should not trigger VimFx commands but be sent through to the page if
613 an “adjustable” element (form control or video player) is focused.
614
615 ### `focus_previous_key` and `focus_next_key`
616
617 The default values are `<s-tab` and `<tab>`, respectively. Those keys are
618 specially handled after focusing a text input using [`gi`]. To disable this
619 special handling, set the options to the empty string.
620
621 [`gi`]: commands.md#gi-1
622
623
624 ## Special options
625
626 These options are available in neither VimFx’s options page in the Add-ons
627 Manager nor in [about:config]. The only way to change them is by using the
628 a [config file].
629
630 ### `translations`
631
632 This option is only useful if you use the [Ignore keyboard layout] option. As
633 mentioned in the documentation for that option, `translations` exist to let you:
634
635 - Teach VimFx about layout customizations you’ve made, that otherwise get
636 ignored.
637 - Make VimFx pretend that some other keyboard layout than the standard en-US
638 QWERTY is always used.
639
640 Here’s some example usage:
641
642 ```js
643 vimfx.set('translations', {
644 // Swapped <capslock> and <escape>.
645 'CapsLock': 'Escape',
646 'Escape': 'CapsLock',
647
648 // AZERTY mappings.
649 'KeyQ': ['a', 'A'],
650 'KeyA': ['q', 'Q'],
651 // etc.
652
653 // Bonus: Distinguish between regular numbers and numpad numbers by
654 // translating the numpad numbers into made-up names (regardless of numlock
655 // state). Then, you can use `<k0>` to `<k9>` in shortcuts.
656 'Numpad0': 'K0',
657 'Numpad1': 'K1',
658 'Numpad2': 'K2',
659 'Numpad3': 'K3',
660 'Numpad4': 'K4',
661 'Numpad5': 'K5',
662 'Numpad6': 'K6',
663 'Numpad7': 'K7',
664 'Numpad8': 'K8',
665 'Numpad9': 'K9',
666 })
667 ```
668
669 More formally, `translations` is an object where:
670
671 - The object keys are [`event.code`] strings that should be translated.
672
673 - The object values are either strings or arrays of two strings.
674
675 If an array is provided, the first value of it is used when shift is _not_
676 held, and the other value when shift _is_ held.
677
678 If only one string is provided, that value is always used (regardless of the
679 shift state).
680
681 The strings are what you want VimFx to treat the pressed key as. For example,
682 providing `Escape` will cause the translated key to match VimFx shortcuts
683 containing `<Escape>` (or `<escape>`—the case doesn’t matter).
684
685 At this point, you might be wondering why these options to ignore your keyboard
686 layout and translate keys have to exist. It’s all about the data that is
687 available in Firefox (basically [`event.key`] and [`event.code`]). There is a
688 longer technical explanation in [vim-like-key-notation], the library VimFx uses
689 for dealing with keyboard stuff.
690
691 [Ignore keyboard layout]: #ignore-keyboard-layout
692 [`event.code`]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
693 [`event.key`]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
694 [vim-like-key-notation]: https://github.com/lydell/vim-like-key-notation#technical-notes
695
696 ### `categories`
697
698 See the documentation for [`vimfx.get('categories')`][categories].
699
700 [categories]: api.md#vimfxgetcategories
Imprint / Impressum