forked from tridactyl/tridactyl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ts
2416 lines (2227 loc) · 85.7 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Sketch
//
// Need an easy way of getting and setting settings
// If a setting is not set, the default should probably be returned.
// That probably means that binds etc. should be per-key?
//
// We should probably store all settings in memory, and only load from storage on startup and when we set it
//
// Really, we'd like a way of just letting things use the variables
//
/** # Tridactyl Configuration
*
* We very strongly recommend that you pretty much ignore this page and instead follow the link below DEFAULTS that will take you to our own source code which is formatted in a marginally more sane fashion.
*
* Intrepid Tridactyl users: this page is how Tridactyl arranges and manages its settings internally. To view your own settings, use `:viewconfig` and `:viewconfig --user`. To understand how to set settings, see `:help set`.
*
*/
import * as R from "ramda"
import * as binding from "@src/lib/binding"
import * as platform from "@src/lib/platform"
import { DeepPartial } from "tsdef"
/* Remove all nulls from objects recursively
* NB: also applies to arrays
*/
const removeNull = R.when(
R.is(Object),
R.pipe(
// Ramda gives an error here without the any
R.reject(val => val === null) as any,
R.map(a => removeNull(a)),
),
)
/** @hidden */
const CONFIGNAME = "userconfig"
/** @hidden */
const WAITERS = []
/** @hidden */
export let INITIALISED = false
/** @hidden */
// make a naked object
export function o(object) {
return Object.assign(Object.create(null), object)
}
/** @hidden */
// "Import" is a reserved word so this will have to do
function schlepp(settings) {
Object.assign(USERCONFIG, settings)
}
/** @hidden */
export let USERCONFIG = o({})
/** @hidden
* Ideally, LoggingLevel should be in logging.ts and imported from there. However this would cause a circular dependency, which webpack can't deal with
*/
export type LoggingLevel = "never" | "error" | "warning" | "info" | "debug"
/**
* This is the default configuration that Tridactyl comes with.
*
* You can change anything here using `set key1.key2.key3 value` or specific things any of the various helper commands such as `bind` or `command`. You can also jump to the help section of a setting using `:help $settingname`. Some of the settings have an input field containing their current value. You can modify these values and save them by pressing `<Enter>` but using `:set $setting $value` is a good habit to take as it doesn't force you to leave the page you're visiting to change your settings.
*
* If the setting you are changing has a dot or period character (.) in it, it cannot be set with `:set` directly. You must either use a helper command for that specific setting - e.g. `:seturl` or `:autocontain`, or you must use Tridactyl's JavaScript API with `:js tri.config.set("path", "to", "key", "value")` to set `{path: {to: {key: value}}}`.
*
*/
export class default_config {
/**
* Internal version number Tridactyl uses to know whether it needs to update from old versions of the configuration.
*
* Changing this might do weird stuff.
*/
configversion = "0.0"
/**
* Internal field to handle site-specific configs. Use :seturl/:unseturl to change these values.
*/
subconfigs: { [key: string]: DeepPartial<default_config> } = {
"www.google.com": {
followpagepatterns: {
next: "Next",
prev: "Previous",
},
},
"^https://web.whatsapp.com": {
nmaps: {
f: "hint -c [tabindex]:not(.two)>div,a",
F: "hint -bc [tabindex]:not(.two)>div,a",
},
},
}
/**
* Internal field to handle mode-specific configs. Use :setmode/:unsetmode to change these values.
*
* Changing this might do weird stuff.
*/
modesubconfigs: { [key: string]: DeepPartial<default_config> } = {
normal: {},
insert: {},
input: {},
ignore: {},
ex: {},
hint: {},
visual: {},
}
/**
* Internal field to handle site-specific config priorities. Use :seturl/:unseturl to change this value.
*/
priority = 0
// Note to developers: When creating new <modifier-letter> maps, make sure to make the modifier uppercase (e.g. <C-a> instead of <c-a>) otherwise some commands might not be able to find them (e.g. `bind <c-a>`)
/**
* exmaps contains all of the bindings for the command line.
* You can of course bind regular ex commands but also [editor functions](/static/docs/modules/_src_lib_editor_.html) and [commandline-specific functions](/static/docs/modules/_src_commandline_frame_.html).
*/
exmaps = {
"<Enter>": "ex.accept_line",
"<C-Enter>": "ex.execute_ex_on_completion",
"<C-j>": "ex.accept_line",
"<C-m>": "ex.accept_line",
"<Escape>": "ex.hide_and_clear",
"<C-[>": "ex.hide_and_clear",
"<ArrowUp>": "ex.prev_history",
"<ArrowDown>": "ex.next_history",
"<S-Del>": "ex.execute_ex_on_completion_args tabclose",
"<A-b>": "text.backward_word",
"<A-f>": "text.forward_word",
"<C-e>": "text.end_of_line",
"<A-d>": "text.kill_word",
"<S-Backspace>": "text.backward_kill_word",
"<C-u>": "text.backward_kill_line",
"<C-k>": "text.kill_line",
"<C-f>": "ex.complete",
"<Tab>": "ex.next_completion",
"<S-Tab>": "ex.prev_completion",
"<Space>": "ex.insert_space_or_completion",
"<C-Space>": "ex.insert_space",
"<C-o>yy": "ex.execute_ex_on_completion_args clipboard yank",
}
/**
* ignoremaps contain all of the bindings for "ignore mode".
*
* They consist of key sequences mapped to ex commands.
*/
ignoremaps = {
"<S-Insert>": "mode normal",
"<AC-Escape>": "mode normal",
"<AC-`>": "mode normal",
"<S-Escape>": "mode normal",
"<C-o>": "nmode normal 1 mode ignore",
}
/**
* imaps contain all of the bindings for "insert mode".
*
* On top of regular ex commands, you can also bind [editor functions](/static/docs/modules/_src_lib_editor_.html) in insert mode.
*
* They consist of key sequences mapped to ex commands.
*/
imaps = {
"<Escape>": "composite unfocus | mode normal",
"<C-[>": "composite unfocus | mode normal",
"<C-i>": "editor",
"<AC-Escape>": "mode normal",
"<AC-`>": "mode normal",
"<S-Escape>": "mode ignore",
}
/**
* inputmaps contain all of the bindings for "input mode".
*
* On top of regular ex commands, you can also bind [editor functions](/static/docs/modules/_src_lib_editor_.html) in input mode.
*
* They consist of key sequences mapped to ex commands.
*/
inputmaps = {
"<Tab>": "focusinput -n",
"<S-Tab>": "focusinput -N",
/**
* Config objects with this key inherit their keys from the object specified.
*
* Only supports "root" objects. Subconfigs (`seturl`) work as expected.
*
* Here, this means that input mode is the same as insert mode except it has added binds for tab and shift-tab.
*/
"🕷🕷INHERITS🕷🕷": "imaps",
}
/**
* Disable Tridactyl almost completely within a page, e.g. `seturl ^https?://mail.google.com disable true`. Only takes affect on page reload.
*
* You are usually better off using `blacklistadd` and `seturl [url] noiframe true` as you can then still use some Tridactyl binds, e.g. `shift-insert` for exiting ignore mode.
*
* NB: you should only use this with `seturl`. If you get trapped with Tridactyl disabled everywhere just run `tri unset superignore` in the Firefox address bar. If that still doesn't fix things, you can totally reset Tridactyl by running `tri help superignore` in the Firefox address bar, scrolling to the bottom of that page and then clicking "Reset Tridactyl config".
*/
superignore: "true" | "false" = "false"
/**
* nmaps contain all of the bindings for "normal mode".
*
* They consist of key sequences mapped to ex commands.
*/
nmaps = {
"<A-p>": "pin",
"<A-m>": "mute toggle",
"<F1>": "help",
o: "fillcmdline open",
O: "current_url open",
w: "fillcmdline winopen",
W: "current_url winopen",
t: "fillcmdline tabopen",
"]]": "followpage next",
"[[": "followpage prev",
"[c": "urlincrement -1",
"]c": "urlincrement 1",
"<C-x>": "urlincrement -1",
"<C-a>": "urlincrement 1",
T: "current_url tabopen",
yy: "clipboard yank",
ys: "clipboard yankshort",
yc: "clipboard yankcanon",
ym: "clipboard yankmd",
yo: "clipboard yankorg",
yt: "clipboard yanktitle",
gh: "home",
gH: "home true",
p: "clipboard open",
P: "clipboard tabopen",
j: "scrollline 10",
"<C-e>": "scrollline 10",
k: "scrollline -10",
"<C-y>": "scrollline -10",
h: "scrollpx -50",
l: "scrollpx 50",
G: "scrollto 100",
gg: "scrollto 0",
"<C-u>": "scrollpage -0.5",
"<C-d>": "scrollpage 0.5",
"<C-f>": "scrollpage 1",
"<C-b>": "scrollpage -1",
"<C-v>": "nmode ignore 1 mode normal", // Is this a terrible idea? Pentadactyl did it http://bug.5digits.org/help/pentadactyl/browsing.xhtml#send-key
$: "scrollto 100 x",
// "0": "scrollto 0 x", // will get interpreted as a count
"^": "scrollto 0 x",
H: "back",
L: "forward",
"<C-o>": "jumpprev",
"<C-i>": "jumpnext",
d: "tabclose",
D: "composite tabprev; tabclose #",
gx0: "tabclosealltoleft",
gx$: "tabclosealltoright",
"<<": "tabmove -1",
">>": "tabmove +1",
u: "undo",
U: "undo window",
r: "reload",
R: "reloadhard",
x: "stop",
gi: "focusinput -l",
"g?": "rot13",
"g!": "jumble",
"g;": "changelistjump -1",
J: "tabprev",
K: "tabnext",
gt: "tabnext_gt",
gT: "tabprev",
// "<c-n>": "tabnext_gt", // c-n is reserved for new window
// "<c-p>": "tabprev",
"g^": "tabfirst",
g0: "tabfirst",
g$: "tablast",
ga: "tabaudio",
gr: "reader --old",
gu: "urlparent",
gU: "urlroot",
gf: "viewsource",
":": "fillcmdline_notrail",
s: "fillcmdline open search",
S: "fillcmdline tabopen search",
// find mode not suitable for general consumption yet.
// "/": "fillcmdline find",
// "?": "fillcmdline find -?",
// n: "findnext 1",
// N: "findnext -1",
// ",<Space>": "nohlsearch",
M: "gobble 1 quickmark",
B: "fillcmdline taball",
b: "fillcmdline tab",
ZZ: "qall",
f: "hint",
F: "hint -b",
gF: "hint -qb",
";i": "hint -i",
";b": "hint -b",
";o": "hint",
";I": "hint -I",
";k": "hint -k",
";K": "hint -K",
";y": "hint -y",
";Y": "hint -cF img i => tri.excmds.yankimage(tri.urlutils.getAbsoluteURL(i.src))",
";p": "hint -p",
";h": "hint -h",
v: "hint -h", // Easiest way of entering visual mode for now. Expect this bind to change
";P": "hint -P",
";r": "hint -r",
";s": "hint -s",
";S": "hint -S",
";a": "hint -a",
";A": "hint -A",
";;": "hint -; *",
";#": "hint -#",
";v": "hint -W mpvsafe",
";V": "hint -V",
";w": "hint -w",
";t": "hint -W tabopen",
";O": "hint -W fillcmdline_notrail open ",
";W": "hint -W fillcmdline_notrail winopen ",
";T": "hint -W fillcmdline_notrail tabopen ",
";z": "hint -z",
";m": "hint -JFc img i => tri.excmds.open('https://lens.google.com/uploadbyurl?url='+i.src)",
";M": "hint -JFc img i => tri.excmds.tabopen('https://lens.google.com/uploadbyurl?url='+i.src)",
";gi": "hint -qi",
";gI": "hint -qI",
";gk": "hint -qk",
";gy": "hint -qy",
";gp": "hint -qp",
";gP": "hint -qP",
";gr": "hint -qr",
";gs": "hint -qs",
";gS": "hint -qS",
";ga": "hint -qa",
";gA": "hint -qA",
";g;": "hint -q;",
";g#": "hint -q#",
";gv": "hint -qW mpvsafe",
";gw": "hint -qw",
";gb": "hint -qb",
// These two don't strictly follow the "bind is ;g[flag]" rule but they make sense
";gF": "hint -qb",
";gf": "hint -q",
"<S-Insert>": "mode ignore",
"<AC-Escape>": "mode ignore",
"<AC-`>": "mode ignore",
"<S-Escape>": "mode ignore",
"<Escape>": "composite mode normal ; hidecmdline",
"<C-[>": "composite mode normal ; hidecmdline",
a: "current_url bmark",
A: "bmark",
zi: "zoom 0.1 true",
zo: "zoom -0.1 true",
zm: "zoom 0.5 true",
zr: "zoom -0.5 true",
zM: "zoom 0.5 true",
zR: "zoom -0.5 true",
zz: "zoom 1",
zI: "zoom 3",
zO: "zoom 0.3",
".": "repeat",
"<AS-ArrowUp><AS-ArrowUp><AS-ArrowDown><AS-ArrowDown><AS-ArrowLeft><AS-ArrowRight><AS-ArrowLeft><AS-ArrowRight>ba":
"open https://www.youtube.com/watch?v=M3iOROuTuMA",
m: "gobble 1 markadd",
"`": "gobble 1 markjump",
}
vmaps = {
"<Escape>":
"composite js document.getSelection().empty(); mode normal; hidecmdline",
"<C-[>":
"composite js document.getSelection().empty(); mode normal ; hidecmdline",
y: "composite js document.getSelection().toString() | clipboard yank",
s: "composite js document.getSelection().toString() | fillcmdline open search",
S: "composite js document.getSelection().toString() | fillcmdline tabopen search",
l: 'js document.getSelection().modify("extend","forward","character")',
h: 'js document.getSelection().modify("extend","backward","character")',
e: 'js document.getSelection().modify("extend","forward","word")',
w: 'js document.getSelection().modify("extend","forward","word"); document.getSelection().modify("extend","forward","word"); document.getSelection().modify("extend","backward","word"); document.getSelection().modify("extend","forward","character")',
b: 'js document.getSelection().modify("extend","backward","character"); document.getSelection().modify("extend","backward","word"); document.getSelection().modify("extend","forward","character")',
j: 'js document.getSelection().modify("extend","forward","line")',
// "j": 'js document.getSelection().modify("extend","forward","paragraph")', // not implemented in Firefox
k: 'js document.getSelection().modify("extend","backward","line")',
$: 'js document.getSelection().modify("extend","forward","lineboundary")',
"0": 'js document.getSelection().modify("extend","backward","lineboundary")',
"=": "js let n = document.getSelection().anchorNode.parentNode; let s = window.getSelection(); let r = document.createRange(); s.removeAllRanges(); r.selectNodeContents(n); s.addRange(r)",
o: "js tri.visual.reverseSelection(document.getSelection())",
"🕷🕷INHERITS🕷🕷": "nmaps",
}
hintmaps = {
"<Backspace>": "hint.popKey",
"<Escape>": "hint.reset",
"<C-[>": "hint.reset",
"<Tab>": "hint.focusNextHint",
"<S-Tab>": "hint.focusPreviousHint",
"<ArrowUp>": "hint.focusTopHint",
"<ArrowDown>": "hint.focusBottomHint",
"<ArrowLeft>": "hint.focusLeftHint",
"<ArrowRight>": "hint.focusRightHint",
"<Enter>": "hint.selectFocusedHint",
"<Space>": "hint.selectFocusedHint",
}
/**
* Browser-wide binds accessible in all modes and on pages where Tridactyl "cannot run".
* <!-- Note to developers: binds here need to also be listed in manifest.json -->
*/
browsermaps = {
"<C-,>": "escapehatch",
"<C-6>": "tab #",
"<CS-6>": "tab #",
}
/**
* Whether to allow pages (not necessarily github) to override `/`, which is a default Firefox binding.
*/
leavegithubalone: "true" | "false" = "false"
/**
* Which keys to protect from pages that try to override them. Requires [[leavegithubalone]] to be set to false.
*/
blacklistkeys: string[] = ["/"]
/**
* Autocommands that run when certain events happen, and other conditions are met.
*
* Related ex command: `autocmd`.
*/
autocmds = {
/**
* Commands that will be run as soon as Tridactyl loads into a page.
*
* Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
*/
DocStart: {
// "addons.mozilla.org": "mode ignore",
},
/**
* Commands that will be run when pages are loaded.
*
* Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
*/
DocLoad: {
"^https://github.com/tridactyl/tridactyl/issues/new$": "issue",
},
/**
* Commands that will be run when pages are unloaded.
*
* Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
*/
DocEnd: {
// "emacs.org": "sanitise history",
},
/**
* Commands that will be run when Tridactyl first runs each time you start your browser.
*
* Each key corresponds to a javascript regex that matches the hostname of the computer Firefox is running on. Note that fetching the hostname could be a little slow, if you want to execute something unconditionally, use ".*" as Tridactyl special-cases this pattern to avoid hostname lookups.
*/
TriStart: {
".*": "source_quiet",
},
/**
* Commands that will be run when you enter a tab.
*
* Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
*/
TabEnter: {
// "gmail.com": "mode ignore",
},
/**
* Commands that will be run when you leave a tab.
*
* Each key corresponds to a URL fragment which, if contained within the page URL, will run the corresponding command.
*/
TabLeft: {
// Actually, this doesn't work because tabclose closes the current tab
// Too bad :/
// "emacs.org": "tabclose",
},
/**
* Commands that will be run when fullscreen state changes.
*/
FullscreenChange: {},
/**
* Commands that will be run when fullscreen state is entered.
*/
FullscreenEnter: {},
/**
* Commands that will be run when fullscreen state is left.
*/
FullscreenLeft: {},
}
/**
* @deprecated Map for translating keys directly into other keys in normal-ish modes.
* For example, if you have an entry in this config option mapping `п` to `g`,
* then you could type `пп` instead of `gg` or `пi` instead of `gi` or `;п` instead
* of `;g`.
*
* This was primarily useful for international users, but now you can `set
* keyboardlayoutforce true`, which will make everything layout-independent(and work like qwerty by default),
* and use [[keyboardlayoutoverrides]] setting to change the desired layout.
*
*
* For example, you may want to map 'a' to 'q` on azerty
* or 'r' to 'p' if you use dvorak.
*
* Note that the current implementation does not allow you to "chain" keys, for example, "a"=>"b" and "b"=>"c" for "a"=>"c". You can, however, swap or rotate keys, so "a"=>"b" and "b"=>"a" will work the way you'd expect, as will "a"=>"b" and "b"=>"c" and "c"=>"a".
*/
keytranslatemap = {
// Examples (I think >_>):
// "д": "l", // Russian language
// "é" : "w", // BÉPO
// "h": "j", // Dvorak
// "n": "j", // Colemak
// etc
}
/**
* @deprecated Whether to use the keytranslatemap.
* Legacy option to map one keyboard character to another, was used to emulate
* layout-independence. Now deprecated since you can set your layout once with [[keyboardlayoutforce]]
* and [[keyboardlayoutoverrides]].
*/
usekeytranslatemap: "true" | "false" = "true"
/**
* Instead of fetching actual character which depends on selected layout,
* use machine code of a key and convert to character according to keyboardlayoutoverrides. The default layout mapping
* is US `qwerty`, but can be changed with [[keyboardlayoutbase]].
*
* There is a much more detailed help page towards the end of `:tutor` under the title "Non-QWERTY layouts".
*
* Recommended for everyone with multiple or/and non-latin keyboard layouts. Make sure [[usekeytranslatemap]] is false
* if you have previously used `keymap`.
*/
keyboardlayoutforce: "true" | "false" = "false"
/**
* Base keyboard layout to use when [[keyboardlayoutforce]] is enabled. At the time of writing, the following layouts are supported: `qwerty, azerty, german, dvorak, uk, ca, bepo`. Requires page reload to take effect.
*
* If your layout is missing, you can contribute it with the help of https://gistpreview.github.io/?324119c773fac31651f6422087b36804 - please just open an `:issue` with your layout and we'll add it.
*
* You can manually override individual keys for a layout with [[keyboardlayoutoverrides]].
*/
keyboardlayoutbase: keyof typeof keyboardlayouts = "qwerty"
/**
* Override individual keys for a layout when [[keyboardlayoutforce]] is enabled. Changes take effect only after a page reload.
*
* Key codes for printable keys for [[keyboardlayoutforce]], lower and upper register. See https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values for the names of each key.
*
* NB: due to a Tridactyl bug, you cannot set this using array notation as you can for, e.g. [[homepage]].
* You must instead set the lower and upper registers using a string with no spaces in it, for example
* `:set keyboardlayoutoverrides Digit2: 2"` for the British English layout.
*/
keyboardlayoutoverrides = {}
/**
* Automatically place these sites in the named container.
*
* Each key corresponds to a URL fragment which, if contained within the page URL, the site will be opened in a container tab instead.
*/
autocontain = o({
// "github.com": "microsoft",
// "youtube.com": "google",
})
/**
* Default proxy to use for all URLs. Has to be the name of a proxy. To add a proxy, see `:help proxyadd`. NB: usage with `:seturl` is buggy, use `:autocontain -s [regex to match URL] none [proxy]` instead
*/
proxy = ""
/**
* Definitions of proxies.
*
* You can add a new proxy with `proxyadd proxyname proxyurl`
*/
proxies = o({
// "socksName": "socks://hostname:port",
// "socks4": "socks4://hostname:port",
// "https": "https://username:password@hostname:port"
})
/**
* Whether to use proxy settings.
*
* If set to `true`, all proxy settings will be ignored.
*/
noproxy: "true" | "false" = "false"
/**
* Strict mode will always ensure a domain is open in the correct container, replacing the current tab if necessary.
*
* Relaxed mode is less aggressive and instead treats container domains as a default when opening a new tab.
*/
autocontainmode: "strict" | "relaxed" = "strict"
/**
* Aliases for the commandline.
*
* You can make a new one with `command alias ex-command`.
*/
exaliases = {
alias: "command",
au: "autocmd",
aucon: "autocontain",
audel: "autocmddelete",
audelete: "autocmddelete",
blacklistremove: "autocmddelete DocStart",
b: "tab",
clsh: "clearsearchhighlight",
nohlsearch: "clearsearchhighlight",
noh: "clearsearchhighlight",
o: "open",
w: "winopen",
t: "tabopen",
tabgroupabort: "tgroupabort",
tabgroupclose: "tgroupclose",
tabgroupcreate: "tgroupcreate",
tabgrouplast: "tgrouplast",
tabgroupmove: "tgroupmove",
tabgrouprename: "tgrouprename",
tabgroupswitch: "tgroupswitch",
tabnew: "tabopen",
tabm: "tabmove",
tabo: "tabonly",
tn: "tabnext_gt",
bn: "tabnext_gt",
tnext: "tabnext_gt",
bnext: "tabnext_gt",
tp: "tabprev",
tN: "tabprev",
bp: "tabprev",
bN: "tabprev",
tprev: "tabprev",
bprev: "tabprev",
tabfirst: "tab 1",
tablast: "tab 0",
bfirst: "tabfirst",
blast: "tablast",
tfirst: "tabfirst",
tlast: "tablast",
buffer: "tab",
bufferall: "taball",
bd: "tabclose",
bdelete: "tabclose",
quit: "tabclose",
q: "tabclose",
qa: "qall",
sanitize: "sanitise",
"saveas!": "saveas --cleanup --overwrite",
tutorial: "tutor",
h: "help",
unmute: "mute unmute",
authors: "credits",
openwith: "hint -W",
"!": "exclaim",
"!s": "exclaim_quiet",
containerremove: "containerdelete",
colours: "colourscheme",
colorscheme: "colourscheme",
colors: "colourscheme",
man: "help",
"!js": "fillcmdline_tmp 3000 !js is deprecated. Please use js instead",
"!jsb": "fillcmdline_tmp 3000 !jsb is deprecated. Please use jsb instead",
get_current_url: "js document.location.href",
current_url: "composite get_current_url | fillcmdline_notrail ",
stop: "js window.stop()",
zo: "zoom",
installnative: "nativeinstall",
nativeupdate: "updatenative",
mkt: "mktridactylrc",
"mkt!": "mktridactylrc -f",
"mktridactylrc!": "mktridactylrc -f",
mpvsafe:
"js -p tri.excmds.shellescape(JS_ARG).then(url => tri.excmds.exclaim_quiet('mpv --no-terminal ' + url))",
drawingstop: "mouse_mode",
exto: "extoptions",
extpreferences: "extoptions",
extp: "extpreferences",
prefset: "setpref",
prefremove: "removepref",
tabclosealltoright: "tabcloseallto right",
tabclosealltoleft: "tabcloseallto left",
reibadailty: "jumble",
}
/**
* Used by `]]` and `[[` to look for links containing these words.
*
* Edit these if you want to add, e.g. other language support.
*/
followpagepatterns = {
next: "^(next|newer)\\b|»|>>|more",
prev: "^(prev(ious)?|older)\\b|«|<<",
}
/**
* The default search engine used by `open search`. If empty string, your browser's default search engine will be used. If set to something, Tridactyl will first look at your [[searchurls]] and then at the search engines for which you have defined a keyword on `about:preferences#search`.
*/
searchengine = ""
/**
* Definitions of search engines for use via `open [keyword]`.
*
* `%s` will be replaced with your whole query and `%s1`, `%s2`, ..., `%sn` will be replaced with the first, second and nth word of your query. Also supports array slicing, e.g. `%s[2:4]`, `%s[5:]`. If there are none of these patterns in your search urls, your query will simply be appended to the searchurl.
*
* Aliases are supported - for example, if you have a `google` searchurl, you can run `:set searchurls.g google` in which case `g` will act as if it was the `google` searchurl.
*
* Examples:
* - When running `open gi cute puppies`, with a `gi` searchurl defined with `set searchurls.gi https://www.google.com/search?q=%s&tbm=isch`, tridactyl will navigate to `https://www.google.com/search?q=cute puppies&tbm=isch`.
* - When running `tabopen translate en ja Tridactyl`, with a `translate` searchurl defined with `set searchurls.translate https://translate.google.com/#view=home&op=translate&sl=%s1&tl=%s2&text=%s3`, tridactyl will navigate to `https://translate.google.com/#view=home&op=translate&sl=en&tl=ja&text=Tridactyl`.
*
* [[setnull]] can be used to "delete" the default search engines. E.g. `setnull searchurls.google`.
*/
searchurls = {
google: "https://www.google.com/search?q=",
googlelucky: "https://www.google.com/search?btnI=I'm+Feeling+Lucky&q=",
scholar: "https://scholar.google.com/scholar?q=",
googleuk: "https://www.google.co.uk/search?q=",
bing: "https://www.bing.com/search?q=",
duckduckgo: "https://duckduckgo.com/?q=",
yahoo: "https://search.yahoo.com/search?p=",
twitter: "https://twitter.com/search?q=",
wikipedia: "https://en.wikipedia.org/wiki/Special:Search/",
youtube: "https://www.youtube.com/results?search_query=",
amazon: "https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=",
amazonuk:
"https://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=",
startpage:
"https://startpage.com/do/search?language=english&cat=web&query=",
github: "https://github.com/search?utf8=✓&q=",
searx: "https://searx.me/?category_general=on&q=",
cnrtl: "http://www.cnrtl.fr/lexicographie/",
osm: "https://www.openstreetmap.org/search?query=",
mdn: "https://developer.mozilla.org/en-US/search?q=",
gentoo_wiki:
"https://wiki.gentoo.org/index.php?title=Special%3ASearch&profile=default&fulltext=Search&search=",
qwant: "https://www.qwant.com/?q=",
}
/**
* Like [[searchurls]] but must be a Javascript function that takes one argument (a single string with the remainder of the command line including spaces) and maps it to a valid href that will be followed, e.g. `set jsurls.googleloud query => "https://google.com/search?q=" + query.toUpperCase()`
*
* NB: the href must be valid, i.e. it must include the protocol (e.g. "http://") and not just be e.g. "www.".
*/
jsurls = {}
/**
* URL the newtab will redirect to.
*
* All usual rules about things you can open with `open` apply, with the caveat that you'll get interesting results if you try to use something that needs `nativeopen`: so don't try `about:newtab` or a `file:///` URI. You should instead use a data URI - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs - or host a local webserver (e.g. Caddy).
*/
newtab = ""
/**
* Whether `:viewsource` will use our own page that you can use Tridactyl binds on, or Firefox's default viewer, which you cannot use Tridactyl on.
*/
viewsource: "tridactyl" | "default" = "tridactyl"
/**
* Pages opened with `gH`. In order to set this value, use `:set homepages ["example.org", "example.net", "example.com"]` and so on.
*/
homepages: string[] = []
/**
* Characters to use in hint mode.
*
* They are used preferentially from left to right.
*/
hintchars = "hjklasdfgyuiopqwertnmzxcvb"
/**
* The type of hinting to use. `vimperator` will allow you to filter links based on their names by typing non-hint chars. It is recommended that you use this in conjuction with the [[hintchars]] setting, which you should probably set to e.g, `5432167890`. ´vimperator-reflow´ additionally updates the hint labels after filtering.
*/
hintfiltermode: "simple" | "vimperator" | "vimperator-reflow" = "simple"
/**
* Whether to optimise for the shortest possible names for each hint, or to use a simple numerical ordering. If set to `numeric`, overrides `hintchars` setting.
*/
hintnames: "short" | "numeric" | "uniform" = "short"
/**
* Whether to display the names for hints in uppercase.
*/
hintuppercase: "true" | "false" = "true"
/**
* The delay in milliseconds in `vimperator` style hint modes after selecting a hint before you are returned to normal mode.
*
* The point of this is to prevent accidental execution of normal mode binds due to people typing more than is necessary to choose a hint.
*/
hintdelay = 300
/**
* Controls whether hints should be shifted in quick-hints mode.
*
* Here's what it means: let's say you have hints from a to z but are only
* interested in every second hint. You first press `a`, then `c`.
* Tridactyl will realize that you skipped over `b`, and so that the next
* hint you're going to trigger is probably `e`. Tridactyl will shift all
* hint names so that `e` becomes `c`, `d` becomes `b`, `c` becomes `a` and
* so on.
* This means that once you pressed `c`, you can keep on pressing `c` to
* trigger every second hint. Only makes sense with hintnames = short.
*/
hintshift: "true" | "false" = "false"
/**
* Controls whether hints should be followed automatically.
*
* If set to `false`, hints will only be followed upon confirmation. This applies to cases when there is only a single match or only one link on the page.
*/
hintautoselect: "true" | "false" = "true"
/**
* Controls whether the page can focus elements for you via js
*
* NB: will break fancy editors such as CodeMirror on Jupyter. Simply use `seturl` to whitelist pages you need it on.
*
* Best used in conjunction with browser.autofocus in `about:config`
*/
allowautofocus: "true" | "false" = "true"
/**
* Uses a loop to prevent focus until you interact with a page. Only recommended for use via `seturl` for problematic sites as it can be a little heavy on CPU if running on all tabs. Should be used in conjuction with [[allowautofocus]]
*/
preventautofocusjackhammer: "true" | "false" = "false"
/**
* Whether to use Tridactyl's (bad) smooth scrolling.
*/
smoothscroll: "true" | "false" = "false"
/**
* How viscous you want smooth scrolling to feel.
*/
scrollduration = 100
/**
* Where to open tabs opened with `tabopen` - to the right of the current tab, or at the end of the tabs.
*/
tabopenpos: "next" | "last" | "related" = "next"
/**
* When enabled (the default), running tabclose will close the tabs whether they are pinned or not. When disabled, tabclose will fail with an error if a tab is pinned.
*/
tabclosepinned: "true" | "false" = "true"
/**
* Controls which tab order to use when numbering tabs. Either mru = sort by most recent tab or default = by tab index
*
* Applies to all places where Tridactyl numbers tabs including `:tab`, `:tabnext_gt` etc. (so, for example, with `:set tabsort mru` `2gt` would take you to the second most recently used tab, not the second tab in the tab bar).
*/
tabsort: "mru" | "default" = "default"
/**
* Where to open tabs opened with hinting - as if it had been middle clicked, to the right of the current tab, or at the end of the tabs.
*/
relatedopenpos: "related" | "next" | "last" = "related"
/**
* The name of the voice to use for text-to-speech. You can get the list of installed voices by running the following snippet: `js alert(window.speechSynthesis.getVoices().reduce((a, b) => a + " " + b.name))`
*/
ttsvoice = "default" // chosen from the listvoices list or "default"
/**
* Controls text-to-speech volume. Has to be a number between 0 and 1.
*/
ttsvolume = 1
/**
* Controls text-to-speech speed. Has to be a number between 0.1 and 10.
*/
ttsrate = 1
/**
* Controls text-to-speech pitch. Has to be between 0 and 2.
*/
ttspitch = 1
/**
* When set to "nextinput", pressing `<Tab>` after gi selects the next input.
*
* When set to "firefox", `<Tab>` behaves like normal, focusing the next tab-indexed element regardless of type.
*/
gimode: "nextinput" | "firefox" = "nextinput"
/**
* Decides where to place the cursor when selecting non-empty input fields
*/
cursorpos: "beginning" | "end" = "end"
/**
* The theme to use.
*
* Permitted values: run `:composite js tri.styling.THEMES | fillcmdline` to find out.
*/
theme = "default"
/**
* Storage for custom themes
*
* Maps theme names to CSS. Predominantly used automatically by [[colourscheme]] to store themes read from disk, as documented by [[colourscheme]]. Setting this manually is untested but might work provided that [[colourscheme]] is then used to change the theme to the right theme name.
*/
customthemes = {}
/**
* Whether to display the mode indicator or not.
*/
modeindicator: "true" | "false" = "true"
/**
* Whether to display the mode indicator in various modes. Ignored if modeindicator set to false.
*/
modeindicatormodes: { [key: string]: "true" | "false" } = {
normal: "true",
insert: "true",
input: "true",
ignore: "true",
ex: "true",
hint: "true",
visual: "true",
}
/**
* Milliseconds before registering a scroll in the jumplist
*/
jumpdelay = 3000
/**
* Logging levels. Unless you're debugging Tridactyl, it's unlikely you'll ever need to change these.
*/
logging: { [key: string]: LoggingLevel } = {
cmdline: "warning",
containers: "warning",
controller: "warning",
excmd: "error",
hinting: "warning",
messaging: "warning",
native: "warning",
performance: "warning",
state: "warning",
styling: "warning",
autocmds: "warning",
}
/**
* Disables the commandline iframe. Dangerous setting, use [[seturl]] to set it. If you ever set this setting to "true" globally and then want to set it to false again, you can do this by opening Tridactyl's preferences page from about:addons.
*/
noiframe: "true" | "false" = "false"
/**
* @deprecated A list of URLs on which to not load the iframe. Use `seturl [URL] noiframe true` instead, as shown in [[noiframe]].
*/
noiframeon: string[] = []
/**
* Insert / input mode edit-in-$EDITOR command to run
* This has to be a command that stays in the foreground for the whole editing session
* "auto" will attempt to find a sane editor in your path.
* Please send your requests to have your favourite terminal moved further up the list to /dev/null.
* (but we are probably happy to add your terminal to the list if it isn't already there.)
*
* Example values:
* - linux: `xterm -e vim`
* - windows: `start cmd.exe /c \"vim\"`.
*
* Also see [:editor](/static/docs/modules/_src_excmds_.html#editor).
*/
editorcmd = "auto"
/**
* Command that should be run by the [[rssexec]] ex command. Has the
* following format:
* - %u: url
* - %t: title
* - %y: type (rss, atom, xml...)
* Warning: This is a very large footgun. %u will be inserted without any
* kind of escaping, hence you must obey the following rules if you care
* about security:
* - Do not use a composite command. If you need a composite command,
* create an alias.
* - Do not use `js` or `jsb`. If you need to use them, create an alias.