]> git.gir.st - VimFx.git/blob - documentation/options.md
Improve CPU usage in Hints mode
[VimFx.git] / documentation / options.md
1 <!--
2 This is part of the VimFx documentation.
3 Copyright Simon Lydell 2015, 2016.
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 in [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 (where you can also customize all [keyboard shortcuts]).
22
23 [keyboard shortcuts]: shortcuts.md
24
25 ### Hint chars
26
27 The characters used for the hints in Hints mode, which can be entered using one
28 of the many `f` commands. See also [The `f` commands].
29
30 [The `f` commands]: commands.md#the-f-commands-1
31
32 ### “Previous”/“Next” link patterns
33
34 Space separated lists of patterns that match links to the previous/next page.
35 Used by the `[` and `]` commands.
36
37 There is a standardized way for websites to tell browsers the URLs to the
38 previous and next page. VimFx looks for that information in the first place.
39 Unfortunately, many websites don’t provide this information. Then VimFx falls
40 back on looking for links on the page that seem to go to the previous/next page
41 using patterns.
42
43 The patterns are matched at the beginning and end of link text (and the
44 attributes defined by the advanced setting [`pattern_attrs`]). The patterns do
45 not match in the middle of words, so “previous” does not match “previously”.
46 The matching is case <strong>in</strong>sensitive.
47
48 Actually, the patterns are regular expressions. If you do not know what a
49 regular expression is, that’s fine. You can type simple patterns like the
50 default ones without problems. If you do know what it is, though, you have the
51 possibility to create more advanced patterns if needed.
52
53 Some of the default patterns are English words. You might want to add
54 alternatives in your own language.
55
56 Note: If you need to include a space in your pattern, use `\s`. For example:
57 `next\spage`.
58
59 [`pattern_attrs`]: #pattern_attrs
60
61 ### Blacklist
62
63 Space separated list of URLs where VimFx should automatically enter Ignore mode.
64 Example:
65
66 *example.com* http://example.org/editor/*
67
68 Note that the URLs in the list must match the current URL _entirely_ for it to
69 apply. Therefore it is easiest to always use the `*` wildcard (which matches
70 zero or more characters).
71
72 (Set the option to `*` to make VimFx start out in Ignore mode _everywhere._)
73
74 You might also want to read about the [Ignore mode `<s-f1>` command][s-f1].
75
76 [s-f1]: commands.md#ignore-mode-s-f1
77
78 ### Prevent autofocus
79
80 Many sites autofocus their search box, for example. This might be annoying when
81 browsing using the keyboard, as you do with VimFx, because it often feels like
82 VimFx isn’t responding, until you realize that you are typing in a text box—not
83 running VimFx commands!
84
85 For this reason VimFx can prevent autofocus. It’s not enabled by default,
86 though, since one of VimFx’s key features is to be nice to your browser and your
87 habits.
88
89 If enabled, all focusing that occurs on page load, or after you’ve just switched
90 back to a tab from another, until you interact with the page is prevented.
91
92 #### Technical notes and trivia
93
94 Autofocus on page load and when coming back to a tab are the two most common
95 cases. Some sites, though, automatically focus a text input in other cases as
96 well. Trying to catch those cases as well, VimFx used to prevent all focusing
97 that didn’t occur within a fixed number of milliseconds after your last
98 interaction (click or keypress). However, this proved to be too aggressive,
99 preventing too much focusing. In other words, the time-based check was not
100 sufficient to distinguish between intended focusing and automatic unwanted
101 focusing. It made things worse more than it helped. Since these cases are so
102 difficult (if not impossible) to detect, it is better to leave them. Thankfully
103 they are not very common.
104
105 On page load or when coming back to a tab, before you have interacted with the
106 page in any way, we can be _sure_ that any focusing is automatic (not caused by
107 you), which makes it safe to prevent all focusing in those time spans.
108
109 ### Ignore keyboard layout
110
111 If you use more than one keyboard layout, you probably want to enable this
112 option.
113
114 People who use a keyboard layout _without_ the letters A–Z usually also use the
115 standard en-US QWERTY layout as well.
116
117 This option makes VimFx ignore your current layout and pretend that the standard
118 en-US QWERTY layout is _always_ used. This way the default shortcuts work even
119 if your layout doesn’t contain the letters A–Z and all shortcuts can be typed by
120 the same physical keys on your keyboard regardless of your current keyboard
121 layout.
122
123 (If you’d like VimFx to pretend that some other keyboard layout than the
124 standard en-US QWERTY is always used, you may do so with the special option
125 [`translations`].)
126
127 [`translations`]: #translations
128
129 ### Timeout
130
131 The maximum amount of time (in milliseconds) that may pass between two
132 keypresses of a shortcut.
133
134 It’s easy to press, say, `a` by mistake while browsing. Without a timeout, you
135 might be surprised that all search results are highlighted when you a bit later
136 try to search using the `/` command. (That’s what `a/` does.) _With_ a timeout,
137 the `a` would be cancelled when the timeout has passed.
138
139
140 ## Advanced options
141
142 These options are _not_ available in VimFx’s settings page in the Add-ons
143 Manager. They can only be changed in [about:config] or using the [public API].
144 They all start with `extensions.VimFx.`.
145
146 (There are actually a few more advanced options than those listed here. You can
147 see them all in [defaults.coffee].)
148
149 [about:config]: http://kb.mozillazine.org/About:config
150 [public API]: api.md
151 [defaults.coffee]: ../extension/lib/defaults.coffee
152
153 ### `notifications_enabled`
154
155 Controls whether [notifications] should be shown or not.
156
157 You can also choose to show notifications any way you want by listening for the
158 [the `notification` and `hideNotification` events][notification-events].
159
160 [notifications]: notifications.md
161 [notification-events]: api.md#the-notification-and-hidenotification-events
162
163 ### `notify_entered_keys`
164
165 If enabled, a [notification] is shown with the keys you have entered so far of
166 a command. This is only noticeable if you type a multi-key shortcut or use a
167 count.
168
169 [notification]: notifications.md
170
171 ### `prevent_target_blank`
172
173 You might have noticed that some links open in new tabs when you click them.
174 That is not the case if you “click” them using VimFx’s `f` command, though. If
175 you dislike that, disable this option.
176
177 ### `counts_enabled`
178
179 Controls whether [counts] are enabled or not.
180
181 [counts]: commands.md#counts
182
183 ### `ignore_ctrl_alt`
184
185 This option is enabled by default on Windows, and disabled otherwise.
186
187 If enabled, ignores ctrl+alt for printable keys. `<a-c-$>` becomes `$` and
188 `<a-c-A>` becomes `A`, while `<a-c-enter>` stays the same.
189
190 This option is suitable on Windows, which treats [AltGr as
191 ctrl+alt][wikipedia-altgr]. For example, if a user of the sv-SE layout on
192 Windows holds AltGr and presses the key labeled `4`, in order to produce a `$`,
193 the result would be `<a-c-$>` without this option, making it impossible to
194 trigger a keyboard shortcut containing `$`. _With_ this option the result is
195 `$`, as expected (and as on GNU/Linux). On the other hand it won’t be possible
196 to trigger keyboard shortcuts such as `<a-c-a>`, but ctrl+alt keyboard shortcuts
197 are [discouraged on Windows][wikipedia-altgr] anyway because of this reason.
198
199 [wikipedia-altgr]: https://en.wikipedia.org/wiki/AltGr_key#Control_.2B_Alt_as_a_substitute
200
201 ### `prevent_autofocus_modes`
202
203 Space separated list of modes where `prevent_autofocus` should be used.
204
205 ### `hints_timeout`
206
207 The number of milliseconds a matched hint marker should stay on screen before
208 disappearing (or resetting).
209
210 ### `hints_sleep`
211
212 In Hints mode, VimFx continually checks if the element for a hint marker has
213 moved. If so, the marker is moved as well. This pref controls how many
214 milliseconds VimFx should “sleep” between each check. The shorter, the more CPU
215 usage, the longer, the more stuttery marker movement.
216
217 The default value should work fine, but if you have a low-performing computer
218 and you notice bothering CPU usage during Hints mode you might want to raise the
219 sleep time.
220
221 Set it to -1 to disable the marker movement feature entirely.
222
223 ### Scrolling prefs
224
225 Apart from its own prefs, VimFx also respects a few built-in Firefox prefs.
226
227 #### Smooth scrolling
228
229 If you want to customize Firefox’s smooth scrolling, adjusting
230 `general.smoothScroll.{lines,pages,other}.duration{Min,Max}MS` is the way to
231 go. VimFx has similar prefs for the scrolling commands, but they work like
232 `layout.css.scroll-behavior.spring-constant`.
233
234 Basically, the higher the value, the faster the scrolling.
235
236 These are VimFx’s variants, and the commands they affect:
237
238 - `smoothScroll.lines.spring-constant`: `h`, `l`, `j`, `k`
239 - `smoothScroll.pages.spring-constant`: `d`, `u`, `<space>`, `<s-space>`
240 - `smoothScroll.other.spring-constant`: `gg`, `G`, `0`, `^`, `$`
241
242 Note that the value of these prefs are _strings,_ not numbers!
243
244 The Firefox pref `general.smoothScroll` lets you turn off smooth scrolling
245 entirely, including all of VimFx’s scrolling commands.
246
247 `general.smoothScroll.lines`, `general.smoothScroll.pages`, and
248 `general.smoothScroll.other` lets you selectively disable smooth scrolling.
249 VimFx’s scrolling commands follow the same “lines,” “pages” and “other”
250 categorization as in the above list.
251
252 #### Scroll step
253
254 By default you can scroll using the arrow keys in Firefox. You can control how
255 much they scroll by adjusting the following prefs:
256
257 - `toolkit.scrollbox.horizontalScrollDistance`: `<left>`, `<right>`, `h`, `l`
258 - `toolkit.scrollbox.verticalScrollDistance`: `<down>`, `<up>`, `j`, `k`
259
260 (VimFx used to have a `scroll_step` pref, but is has been replaced by the
261 above.)
262
263 #### `scroll.full_page_adjustment` and `scroll.half_page_adjustment`
264
265 An important use case for scrolling a full page down is to read an entire page
266 (a window-full) of text, press `<space>` and then continue reading the next
267 page. However, if you can only see, say, _half_ of the height the last line,
268 pressing `<space>` would give you the other half, but reading only the top or
269 bottom parts of letters is difficult. Even if the lines happen to line up with
270 the window edge to not be sliced horizontally, it might feel disorienting
271 pressing `<space>`.
272
273 For this reason, both VimFx and Firefox by default scroll _about a line less
274 than a whole page_ when pressing `<space>`. This solves the sliced-last-line
275 problem, and provides some context on where you are in the text you’re reading.
276
277 These two prefs control how many pixels “about a line” actually means for the
278 different page scrolling commands.
279
280 - `scroll.full_page_adjustment`: `<space>, `<s-space>`
281 - `scroll.half_page_adjustment`: `d`, `u`
282
283 #### `scroll.last_position_mark`
284
285 The special mark for the [`` ` ``][scroll-to-mark] command that takes you to the
286 last position.
287
288 [scroll-to-mark]: commands.md#marks-m-and-
289
290 ### `pattern_selector`
291
292 A CSS selector that targets candidates for a previous/next page link.
293
294 ### `pattern_attrs`
295
296 A space-separated list of attributes that the [“Previous”/“Next” link patterns]
297 should be matched against.
298
299 [“Previous”/“Next” link patterns]: #previousnext-link-patterns
300
301 ### `hints_toggle_in_tab`
302
303 If the keypress that matched a hint starts with this string, toggle whether to
304 open the matched link in the current tab or a new tab. See [The `f` commands]
305 for more information.
306
307 ### `hints_toggle_in_background`
308
309 If the keypress that matched a hint starts with this string, open the matched
310 link in a new tab and toggle whether to open that tab in the background or
311 foreground. See [The `f` commands] for more information.
312
313 ### `activatable_element_keys`
314
315 Keys that should not trigger VimFx commands but be sent through to the page if
316 an “activatable” element (link or button) is focused.
317
318 ### `adjustable_element_keys`
319
320 Keys that should not trigger VimFx commands but be sent through to the page if
321 an “adjustable” element (form control or video player) is focused.
322
323 ### `focus_previous_key` and `focus_next_key`
324
325 The default values are `<s-tab` and `<tab>`, respectively. Those keys are
326 specially handled after focusing a text input using [`gi`]. To disable this
327 special handling, set the prefs to the empty string.
328
329 [`gi`]: commands.md#gi-1
330
331
332 ## Special options
333
334 These options are available in neither VimFx’s settings page in the Add-ons
335 Manager nor in [about:config]. The only way to change them is by using the
336 [public API].
337
338 ### `translations`
339
340 See the description of the `translations` option in [vim-like-key-notation].
341
342 [vim-like-key-notation]: https://github.com/lydell/vim-like-key-notation#api
343
344 ### `categories`
345
346 See the documentation for [`vimfx.get('categories')`][categories].
347
348 [categories]: api.md#vimfxgetcategories
Imprint / Impressum