Skip to content

Instantly share code, notes, and snippets.

@rsenna
Last active August 12, 2025 10:10
Show Gist options
  • Select an option

  • Save rsenna/1935961f09b6422415bf804e64cc1dab to your computer and use it in GitHub Desktop.

Select an option

Save rsenna/1935961f09b6422415bf804e64cc1dab to your computer and use it in GitHub Desktop.
const {
Clipboard,
Front,
Hints,
Normal,
RUNTIME,
Visual,
aceVimMap,
addSearchAlias,
cmap,
getClickableElements,
imap,
imapkey,
iunmap,
map,
mapkey,
readText,
removeSearchAlias,
tabOpenLink,
unmap,
unmapAllExcept,
vmapkey,
vunmap,
} = api;
Hints.setCharacters("asdfghjkl;'\\");
settings.defaultSearchEngine = "d";
settings.hintAlign = "left";
settings.enableEmojiInsertion = true;
settings.startToShowEmoji = 4;
settings.modeAfterYank = "Normal";
settings.focusFirstCandidate = true;
// ---- Map -----
// Open Hint in new tab
map("F", "C");
// Open Clipboard URL in new tab
map("P", "cc");
// History Back/Forward
map("H", "S");
map("L", "D");
// Scroll Page Down/Up
mapkey("<Ctrl-d>", "Scroll down", () => {
Normal.scroll("pageDown");
});
mapkey("<Ctrl-u>", "Scroll up", () => {
Normal.scroll("pageUp");
});
// Scroll Full Page Up
map("<Ctrl-b>", "U");
// About Pages
mapkey(";cfg", "Open Firefox Config", () => {
tabOpenLink("about:config");
});
mapkey(";cfp", "Open Firefox Settings", function () {
tabOpenLink("about:preferences");
});
// --- Tabs ---
cmap("<Alt-n>", "<Tab>");
cmap("<Alt-p>", "<Shift-Tab>");
// ---- Unmap -----
// Misc
unmap("ob");
unmap("og");
unmap("od");
unmap("oy");
// ---- Search Engines -----
removeSearchAlias("b", "s");
removeSearchAlias("d", "s");
removeSearchAlias("g", "s");
removeSearchAlias("h", "s");
removeSearchAlias("w", "s");
removeSearchAlias("y", "s");
removeSearchAlias("s", "s");
addSearchAlias("d", "ddg", "https://duckduckgo.com/?q=", "s");
addSearchAlias("r", "reddit", "https://libreddit.spike.codes/r/", "s");
addSearchAlias("y", "yt", "https://www.youtube.com/search?q=", "s");
// yt fix
unmap("0", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
unmap("1", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
unmap("2", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
unmap("3", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
unmap("4", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
unmap("5", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
unmap("6", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
unmap("7", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
unmap("8", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
unmap("9", /https?:\/\/(?:www\.)?youtube\.com\/.*/i);
// ---- Set Theme -----
const hintsCss = "font-size: 13px; font-family: monospace !important;";
api.Hints.style(hintsCss);
api.Hints.style(hintsCss, "text");
settings.smoothScroll = true;
settings.defaultSearchEngine = "d";
settings.theme = `
:root {
--theme-ace-bg:#282828ab; /*Note the fourth channel, this adds transparency*/
--theme-ace-bg-accent:#3c3836;
--theme-ace-fg:#ebdbb2;
--theme-ace-fg-accent:#7c6f64;
--theme-ace-cursor:#928374;
--theme-ace-select:#458588;
}
#sk_usage * {
font-size: 13px;
font-family: monospace;
}
#sk_editor {
height: 50% !important; /*Remove this to restore the default editor size*/
background: var(--theme-ace-bg) !important;
font-size: 13px;
font-family: monospace;
}
.sk_theme input {
font-size: 13px !important;
font-family: monospace !important;
}
.ace_dialog-bottom{
border-top: 1px solid var(--theme-ace-bg) !important;
}
.ace-chrome .ace_print-margin, .ace_gutter, .ace_gutter-cell, .ace_dialog{
background: var(--theme-ace-bg-accent) !important;
}
.ace-chrome{
color: var(--theme-ace-fg) !important;
}
.ace_gutter, .ace_dialog {
color: var(--theme-ace-fg-accent) !important;
}
.ace_cursor{
color: var(--theme-ace-cursor) !important;
}
.normal-mode .ace_cursor{
background-color: var(--theme-ace-cursor) !important;
border: var(--theme-ace-cursor) !important;
}
.ace_marker-layer .ace_selection {
background: var(--theme-ace-select) !important;
} `;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment