]> git.gir.st - VimFx.git/blob - documentation/options.md
Document public API
[VimFx.git] / documentation / options.md
1 <!--
2 This is part of the VimFx documentation.
3 Copyright Simon Lydell 2015.
4 See the file README.md for copying conditions.
5 -->
6
7 # Options
8
9 VimFx has many options that can be configured, but they all have nice defaults
10 so you shouldn’t need to.
11
12 You might also be interested [styling] VimFx and writing a [config file].
13
14 [styling]: styling.md
15 [config file]: config-file.md
16
17
18 ## Regular options
19
20 These options are available in VimFx’s settings page in the Add-ons Manager.
21
22 ### Hint chars
23
24 The characters used for the hints in Hints mode, which can be entered using one
25 of the many `f` commands.
26
27 ### Previous/Next page patterns
28
29 Space separated lists of patterns that match links to the previous/next page.
30 Used by the `[` and `]` commands.
31
32 There is a standardized way for websites to tell browsers the URLs to the
33 previous and next page. VimFx looks for that information in the first place.
34 Unfortunately, many websites don’t provide this information. Then VimFx falls
35 back on looking for links on the page that seem to go to the previous/next page
36 using patterns.
37
38 The patterns are matched at the beginning and end of link text (and the
39 attributes defined by the advanced setting [`pattern_attrs`]). The patterns do
40 not match in the middle of words, so “previous” does not match “previously”.
41 The matching is case <strong>in</strong>sensitive.
42
43 Actually, the patterns are regular expressions. If you do not know what a
44 regular expression is, that’s fine. You can type simple patterns like the
45 default ones without problems. If you do know what it is, though, you have the
46 possibility to create more advanced patterns if needed.
47
48 Some of the default patterns are English words. You might want to add
49 alternatives in your own language.
50
51 Note: If you need to include a space in your pattern, use `\s`. For example:
52 `next\spage`.
53
54 [`pattern_attrs`]: #pattern_attrs
55
56 ### Blacklist
57
58 Space separated list of URLs where VimFx should automatically enter Insert mode.
59
60 Note that the URLs in the list must match the current URL _entirely_ for it to
61 apply. Therefore it is easiest to always use the `*` wildcard (which matches
62 zero or more characters).
63
64 ### Prevent autofocus
65
66 Many sites autofocus their search box, for example. This might be annoying when
67 browsing using the keyboard, as you do with VimFx, because it often feels like
68 VimFx isn’t responding, until you realize that you are typing in a text box—not
69 running VimFx commands!
70
71 For this reason VimFx prevents autofocus. If you dislike that, or think the
72 prevention is too aggressive, you may disable it, returning to the standard
73 behavior.
74
75 What is meant by “aggressive”? Well, in fact it is very hard to tell if a focus
76 was an “autofocus” or a “regular focus” caused by you. VimFx prevents all
77 focusing that doesn’t happen reasonably close (200ms by default) to an
78 interaction by you (such as clicking something or using one of the `f`
79 commands). (You may change what “reasonably close” means through the advanced
80 setting [`autofocus_limit`]).
81
82 [`autofocus_limit`]: #autofocus_limit
83
84 ### Ignore keyboard layout
85
86 If you use more than one keyboard layout, you probably want to enable this
87 option.
88
89 People who use a keyboard layout without the letters A-Z usually also use the
90 standard en-US QWERTY layout as well.
91
92 This option makes VimFx ignore your current layout and pretend that the standard
93 en-US QWERTY layout is always used. This way the default shortcuts work even if
94 your layout doesn’t contain the letters A-Z and all shorcuts can be typed by the
95 same physical keys on your keyboard regardless of your current keyboard layout.
96
97 (If you’d like VimFx to pretend that some other keyboard layout than the
98 standard en-US QWERTY is always used, you may do so with the special option
99 [`translations`].)
100
101 [`translations`]: #translations
102
103 ### Timeout
104
105 The maximum amount of time (in milliseconds) that may pass between two
106 keypresses of a shortcut.
107
108 It’s easy to press, say, `a` by mistake while browsing. Without a timeout, you
109 might be surprised that all search results are highlighted when you a bit later
110 try to search using the `/` command. (That’s what `a/` does.) _With_ a timeout,
111 the `a` would be cancelled when the timeout has passed.
112
113
114 ## Advanced options
115
116 These options are _not_ available in VimFx’s settings page in the Add-ons
117 Manager. They can only be changed in [about:config] or using the [public API].
118 They all start with `extensions.VimFx.`.
119
120 (There are actually a few more advanced options than those listed here. You can
121 see them all in [defaults.coffee].)
122
123 [about:config]: http://kb.mozillazine.org/About:config
124 [public API]: api.md
125 [defaults.coffee]: ../extension/lib/defaults.coffee
126
127 ### `prevent_target_blank`
128
129 You might have noticed that some links open in new tabs when you click them.
130 That is not the case if you “click” them using VimFx’s `f` command, though. If
131 you dislike that, disable this option.
132
133 ### `autofocus_limit`
134
135 If `prevent_autofocus` is enabled, all focus events except those that occur
136 within this number of milliseconds after a user interaction are suppressed.
137
138 ### `hints_timeout`
139
140 The number of milliseconds a matched hint marker should stay on screen before
141 disappearing (or resetting).
142
143 ### Scrolling prefs
144
145 If you want to customize Firefox’s smooth scrolling, adjusting
146 `general.smoothScroll.{lines,pages,other}.duration{Min,Max}MS` is the way to
147 go. VimFx has similar prefs for the scrolling commands, but they work like
148 `layout.css.scroll-behavior.spring-constant`.
149
150 Basically, the higher the value, the faster the scrolling.
151
152 These are VimFx’s variants, and the commands they affect:
153
154 - `smoothScroll.lines.spring-constant`: `h`, `l`, `j`, `k`
155 - `smoothScroll.pages.spring-constant`: `d`, `u`, `<space>`, `<s-space>`
156 - `smoothScroll.other.spring-constant`: `gg`, `G`, `0`, `^`, `$`
157
158 Note that the value of these prefs are _strings,_ not numbers!
159
160 VimFx’s scrolling commands also respect a few built-in Firefox prefs.
161
162 `general.smoothScroll` lets you turn off smooth scrolling entirely, including
163 all of VimFx’s scrolling commands.
164
165 `general.smoothScroll.lines`, `general.smoothScroll.pages`, and
166 `general.smoothScroll.other` lets you selectively disable smooth scrolling.
167 VimFx’s scrolling commands follow the same “lines,” “pages” and “other”
168 categorization as in the above list.
169
170 By default you can scroll using the arrow keys in Firefox. You can control how
171 much they scroll by adjusting the following prefs:
172
173 - `toolkit.scrollbox.horizontalScrollDistance`: `<left>`, `<right>`, `h`, `l`
174 - `toolkit.scrollbox.verticalScrollDistance`: `<down>`, `<up>`, `j`, `k`
175
176 (VimFx used to have a `scroll_step` pref, but is has been replaced by the
177 above.)
178
179 ### `pattern_selector`
180
181 A CSS selector that targets candidates for a previous/next page link.
182
183 ### `pattern_attrs`
184
185 A space-separated list of attributes that the previous/next page patterns should
186 be matched against.
187
188 ### `activatable_element_keys`
189
190 Keys that should not trigger VimFx commands but be sent through to the page if
191 an “activatable” element (link or button) is focused.
192
193 ### `adjustable_element_keys`
194
195 Keys that should not trigger VimFx commands but be sent through to the page if
196 an “adjustable” element (form control or video player) is focused.
197
198
199 ## Special options
200
201 These options are available in neither VimFx’s settings page in the Add-ons
202 Manager nor in [about:config]. The only way to change them is by using the
203 [public API].
204
205 ### `translations`
206
207 See the description of the `translations` option in [vim-like-key-notation].
208
209 [vim-like-key-notation]: https://github.com/lydell/vim-like-key-notation#api
Imprint / Impressum