Surfingkeys
https://raw.githubusercontent.com/brookhong/Surfingkeys/master/sk.svg
Surfingkeys: Map your keys for web surfing, expand your browser with javascript and keyboard.
2015-09-15 Surfingkeys -- A better alternative for vimium or cVim
一套可用類似Vim機制操作瀏覽器的瀏覽器擴充功能
Vim-like
基礎操作
使用hjkl左下上右移動
可用食指定位鍵j是「向後(下)移動」來記憶
肌肉記憶
於前方加上數字可指定移動範圍
例如5j會往下移動5行
個人覺得Surfingkeys最常用的功能鍵?kujakujira.icon
table:基礎操作
d 向下捲動
e 向上捲動
x 關閉當前分頁
X 重新開啟先前關閉的分頁
F(Shift+f) 於新分頁開啟當前頁面連結 小寫則是於當前分頁開啟
J(Shift+j) 跳至前一個分頁 Ctrl+Shift+Tab
K(Shift+k) 跳至後一個分頁 Ctrl+Tab
? 查看完整操作介紹
切換模式
Vim分有各種操作模式
切換模式(Vim)
SurfingKeys也分有預設模式、選擇模式、輸入模式與搜尋模式
有些操作必須在特定模式中才能使用
預設模式可使用如向下捲動、開啟連結或關閉分頁等操作
選擇模式才能使用鍵盤選擇(反白)文字
輸入模式才能使用鍵盤輸入文字
v:進入選擇模式
/:進入搜尋模式
於可輸入的文字框處會自動轉為輸入模式
i:搜尋頁面上的可輸入文字框
<Alt-s>:停用 SurfingKeys
例如遊玩網頁遊戲的時候
個人設定檔
關閉PDF viewer
$ ;s
$ https://scrapbox.io/api/code/1cc/Surfingkeys/config.js
code:config.js
api.Hints.characters = "asdfghjklvbnmrtyu";
api.Hints.characterUpper = false;
settings.hintAlign = "left";
settings.smoothScroll = false;
settings.modeAfterYank = "Normal";
settings.focusFirstCandidate = false;
settings.defaultSearchEngine = "d";
settings.tabsThreshold = 9999;
// settings.stealFocusOnLoad = false;
// --- mapping ---
api.map("H", "S"); // back in history
api.unmap("S");
api.map("L", "D"); // forward in history
api.unmap("D");
// api.map("J", "E"); // previous tab
// api.unmap("E");
// api.map("K", "R"); // next tab
// api.unmap("R");
api.unmap("<Ctrl-c>");
api.unmap("<Ctrl-i>");
api.map("<Ctrl-h>", "<<");
api.map("<Ctrl-l>", ">>");
api.map("F", "gf");
api.map("Q", ";di");
api.mapkey("o", "Open a URL in current tab", () => {
api.Front.openOmnibar({ type: "URLs", tabbed: false });
});
let openClipboard = (newTab = false) => {
api.Clipboard.read((response) => {
var markInfo = {
scrollLeft: 0,
scrollTop: 0,
};
if (newTab) {
markInfo.tab = {
tabbed: true,
active: true,
};
} else {
markInfo.tab = {
tabbed: false,
active: false,
};
}
if (response.data.match(/^http/)) {
markInfo.url = response.data;
} else {
markInfo.url =
// 'https://www.google.com/search?q=' +
"https://duckduckgo.com/?q=" + encodeURIComponent(response.data);
}
api.RUNTIME("openLink", markInfo);
});
};
api.mapkey("p", "Open URL in clipboard", () => {
openClipboard();
});
api.mapkey("P", "Open clipboard URL in new tab", () => {
openClipboard(true);
});
api.mapkey("yY", "Copy current page's link as markdown format", () => {
const url = new URL(window.location.href);
var title = window.document.title.replace(/(<|>)/g, "\\$1");
api.Clipboard.write([${title}](${url.href}));
});
api.mapkey("ys", "Copy current page's link as scrapbox format", () => {
const url = new URL(window.location.href);
var title = window.document.title.replace(/(<|>)/g, "\\$1").replaceAll(/\*\*/g, "");
api.Clipboard.write([${title} ${url.href}]);
});
api.mapkey("yo", "Copy current page's OGP image", () => {
var ogImage = document.querySelector('metaproperty="og:image"').content;
api.Clipboard.write(${ogImage});
});
api.mapkey("gy", "Go to membership page of YouTube", () => window.location.href = https://www.youtube.com/playlist?list=UUMO${document.querySelector("link[rel='canonical']").href.split("channel/")[1].substring(2)});
// --- ESC hatch ---
api.map("<Ctrl-[>", "<Esc>");
// api.map("<Ctrl-c>", "<Esc>");
api.imap("<Ctrl-[>", "<Esc>");
// api.imap("<Ctrl-c>", "<Esc>");
api.cmap("<Ctrl-[>", "<Esc>");
// api.cmap("<Ctrl-c>", "<Esc>");
// --- insert mode ---
api.iunmap(":");
api.iunmap("<Ctrl-f>");
api.iunmap("<Ctrl-u>");
api.iunmap("<Ctrl-i>");
api.addSearchAlias("t", "Twitter", "https://twitter.com/search?q=");
api.addSearchAlias(
"y",
"YouTube",
"https://www.youtube.com/results?search_query="
);
// --- 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: 20pt;
}`;
關聯項目
Vimium
Vim Vixen
qutebrowser