summaryrefslogtreecommitdiff
path: root/home/xyz/.config/myconf/surfingkeys_config.js
blob: 9ee90c0a8e9ea765aa0cb6c00be4eccd820863aa (plain)
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
// https://github.com/brookhong/Surfingkeys/wiki/Migrate-your-settings-from-0.9.74-to-1.0
const {
	aceVimMap,
	mapkey,
	imap,
	imapkey,
	getClickableElements,
	vmapkey,
	map,
	unmap,
	vunmap,
	cmap,
	addSearchAlias,
	removeSearchAlias,
	tabOpenLink,
	readText,
	Clipboard,
	Front,
	Hints,
	Visual,
	RUNTIME,

	iunmap,
} = api;

// old example config, may not work. also, I change ctrl-y to Ctrl-y
// an example to create a new mapping `ctrl-y`
//mapkey('<Ctrl-y>', 'Show me the money', function() {
//	Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).');
//});
// an example to replace `T` with `gt`, click `Default mappings` to see how `T` works.
//map('gt', 'T');

// I choose to use <Alt-i>, <Alt-s>, or <p> instead. I prefer <p>
//settings.blacklistPattern = /.*youtube\.com.*|.*mail\.google\.com.*/i;

//unmap('<Ctrl-j>');
map(';h','<Ctrl-h>');
unmap('<Ctrl-h>');
// alt-s not working, seems because arkenfox user.js enabled resist finger printing
// more see /home/xyz/.mozilla/firefox/xxxxxxxx.fly/user.js "1222285 & 1433592", seems related to firefox bugzilla https://bugzilla.mozilla.org/show_bug.cgi?id=1222285 and https://bugzilla.mozilla.org/show_bug.cgi?id=1433592 , user.js worte that RFP spoof alt and shift keys, I guess maybe this causes alt-s not working
// alt-s much map to one keystroke, so map to ;s does not work, see https://github.com/brookhong/Surfingkeys?tab=readme-ov-file#hotkey-to-toggle-surfingkeys: "hotkey must be one keystroke with/without modifier, it can not be a sequence of keystrokes like `gg`."
// note I map to Ctrl-e because it is the only ctrl-alphabet hotkey firefox does not has a hotkey for, note it used to be firenvim default hotkey but I changed to ctrl-,
map('<Ctrl-e>','<Alt-s>');
//unmap('<Alt-s>');
map(';i','<Alt-i>');
// I need firefox default ctrl-i hotkey, and surfingkeys ctrl-i hotkey doesn't seem to work anyway
unmap('<Ctrl-i>');

// on firefox, firenvim default Ctrl-e will be overwirted by github issue hotkey, see:
// https://github.com/glacambre/firenvim/issues/1046
// https://bugzilla.mozilla.org/show_bug.cgi?id=1713794
// currently seems no good solution but to use another hotkey, I choose Ctrl+,
// current surfingkeys version 0.9.74 is outdated and doesn't contain firenvim integration, wait for author to update
// I tried to run the source code as temp extension in about:debugging or with web-ext cli tool but no luck
// update: surfingkeys 1.0 is out, but it integrate neovim in another way, and firefox is not supported? 
// https://github.com/brookhong/Surfingkeys/issues/1542#:~:text=side%20is%20not-,necessary,-now%2C%20please%20help
// some more links:
// https://github.com/brookhong/Surfingkeys/tree/master/src/nvim/server
// but now it seems surfingkeys neovim integration for firefox will not happen in the near future, so I'm not set it to true anymore
//settings.useNeovim = true;

// disable all insert mode hotkeys except Ctrl-i for future neovim integration
// but now it seems surfingkeys neovim integration for firefox will not happen in the near future, so I re-disable it
iunmap('<Ctrl-i>');
iunmap('<Alt-b>');
iunmap('<Alt-d>');
iunmap('<Alt-f>');
iunmap('<Alt-w>');
iunmap("<Ctrl-'>");
iunmap('<Ctrl-e>');
iunmap('<Ctrl-f>');
iunmap('<Ctrl-u>');

// following code of map n to nzz not working in 1.0
// I guess it may because Visual.next and Visual.feedkeys is not supported in new api, see below source code permalink
// https://github.com/brookhong/Surfingkeys/blob/3d1de8cab8584209cc6fec3ed7025e8ebab476d8/src/content_scripts/common/api.js#L774-L776
//mapkey('n','Find next then center cursor', function(){
//	Visual.next(false);
//	Visual.feedkeys('zz');
//});
//mapkey('N','Find previous then center cursor', function(){
//	Visual.next(true);
//	Visual.feedkeys('zz');
//});

// with firefox RFP enabled in user.js, smooth scroll and gg/G do not work, firefox RFP's feature
settings.smoothScroll = false;

// set theme
settings.theme = `
.sk_theme {
	font-family: Input Sans Condensed, Charcoal, sans-serif;
	font-size: 10pt;
	background: #24272e;
	color: #abb2bf;
}
.sk_theme tbody {
	color: #fff;
}
.sk_theme input {
	color: #d0d0d0;
}
.sk_theme .url {
	color: #61afef;
}
.sk_theme .annotation {
	color: #56b6c2;
}
.sk_theme .omnibar_highlight {
	color: #528bff;
}
.sk_theme .omnibar_timestamp {
	color: #e5c07b;
}
.sk_theme .omnibar_visitcount {
	color: #98c379;
}
.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) {
	background: #303030;
}
.sk_theme #sk_omnibarSearchResult ul li.focused {
	background: #3e4452;
}
#sk_status, #sk_find {
	font-size: 16pt;
}`;
// click `Save` button to make above settings to take effect.</ctrl-i></ctrl-y>