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