Last active
March 14, 2022 01:45
-
-
Save AGou-ops/950bcf618cdfff3a40cf0f88ee6c2071 to your computer and use it in GitHub Desktop.
Default Surfingkeys Settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
unmap, | |
iunmap, | |
vunmap, | |
aceVimMap, | |
mapkey, | |
imap, | |
imapkey, | |
getClickableElements, | |
vmapkey, | |
map, | |
cmap, | |
addSearchAlias, | |
removeSearchAlias, | |
tabOpenLink, | |
readText, | |
Clipboard, | |
Front, | |
Hints, | |
Visual, | |
RUNTIME | |
} = api; | |
//添加按键Hints配置。一定程度上规避,因逻辑上无脑组合按键的生成,导致违背手掌舒适度的问题。 | |
//分析过程 https://github.com/brookhong/Surfingkeys/commit/ebd4aad2f0fd6946538cced005470366f2170ae4 | |
Hints.setCharacters('asfqwertvb'); | |
//历史记录搜索,不使用默认的MU排序。MU排序太鸡肋。 | |
settings.historyMUOrder = false; | |
//关于光标定位到地址栏无法定位回页面的问题。 | |
//可以在浏览器设置里面添加特殊的搜索引擎来实现。搜索引擎的地址为javascript: 关键字设置为";" 最好关键字的中英文个添加一个搜索引擎。这样就很ok了。 | |
//注意:与其他扩展的快捷键冲突问题。没有很好的实现。发现p按键,可以短暂失效按键捕获。只能说是一个方案,但是很鸡肋。比如和简悦的冲突。 | |
// 1.冲突修改 | |
//与浏览器冲突部分,个人认为它更好 | |
// 移除与浏览器的冲突 查看下载历史,历史记录 | |
unmap('<Ctrl-j>'); | |
iunmap('<Ctrl-j>'); | |
vunmap('<Ctrl-j>'); | |
unmap('<Ctrl-h>'); | |
iunmap('<Ctrl-h>'); | |
vunmap('<Ctrl-h>'); | |
// 2.vimium兼容。个人认为vimium逻辑更好 | |
// 相当于是<Shift-[jkhl]> | |
map('H', 'S'); // 历史后退 | |
map('L', 'D'); // 历史前进 | |
map('J', 'E'); // tab向左 | |
map('K', 'R'); // tab向右 | |
map('h', 'oh'); // 最直接的理念。 | |
// 3.当前搜索结果选取,各种按键冲突和不灵。<ctrl-n>是个问题会打开新的窗口,而且<ctrl-.>,<ctrl-,>不起作用 | |
// 个人设置的搜索结果快捷键。 采用vim的逻辑。 | |
// 相当于是<alt-[jkhl]> 。 原本想采用<ctrl-[jkhl]>,但 ctrl-k 等容易和浏览器快捷键冲突 | |
// jk上下条目,hl,左右页条目 | |
//cmap('<Alt-j>','<Ctrl-n>'); | |
//cmap('<Alt-k>','<Ctrl-p>'); | |
//cmap('<Alt-l>','<Ctrl-.>'); | |
//cmap('<Alt-h>','<Ctrl-,>'); | |
//cmap和map是不冲突的。 | |
//那么alt键的引入没必要了。因为他本来就不属于vim和emacs,那么直接用<Shift-[jkhl]>,和兼容vimium一样的逻辑就行了。减少新键位的引入。同时使用上更舒适 | |
//cmap('J','<Ctrl-n>'); | |
//cmap('K','<Ctrl-p>'); | |
//cmap('L','<Ctrl-.>'); | |
//cmap('H','<Ctrl-,>'); | |
//又发现新问题。搜索结果还是不应该用<Shift-[jkhl]>。因为牵扯到大写jkhl的输入问题。 | |
//还是改回来吧。<alt-[jkhl]> | |
cmap('<Alt-j>', '<Ctrl-n>'); | |
cmap('<Alt-k>', '<Ctrl-p>'); | |
cmap('<Alt-l>', '<Ctrl-.>'); | |
cmap('<Alt-h>', '<Ctrl-,>'); | |
// 注意:默认ge,打开扩展管理。但是一般不用。不如直接打开,应用商店 | |
//function openChromeExtentonStore() { | |
// tabOpenLink("https://chrome.google.com/webstore/category/extensions?hl=zh-CN"); | |
//} | |
// mapkey('ge', '打开应用商店', openChromeExtentonStore); | |
// an example to create a new mapping `ctrl-y` | |
api.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. | |
api.map('gt', 'T'); | |
// an example to remove mapkey `Ctrl-i` | |
api.unmap('<ctrl-i>'); | |
// set theme | |
settings.theme = ` | |
.sk_theme { | |
font-family: Input Sans Condensed, Charcoal, sans-serif; | |
font-size: 15pt; | |
background: #24272e; | |
color: #abb2bf; | |
} | |
.ace_cursor{ | |
color: #00ff15! important; | |
} | |
.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: 20pt; | |
}`; | |
// click `Save` button to make above settings to take effect.</ctrl-i></ctrl-y> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment