Skip to content

Instantly share code, notes, and snippets.

@mirbehroznoor
Last active August 22, 2026 18:59
Show Gist options
  • Select an option

  • Save mirbehroznoor/de0df8ad9870a69d00e998087f66a0f2 to your computer and use it in GitHub Desktop.

Select an option

Save mirbehroznoor/de0df8ad9870a69d00e998087f66a0f2 to your computer and use it in GitHub Desktop.
Surfingkeys config file
// ## Surfingkeys is a web browser extension (including Google Chrome, Chromium based browsers, Firefox, Safari)
// ~~~~~~~~~~~~~~~~~~~~~~~SETUP
// I use this Surfingkeys config as a personal file for advance settings in firefox.
// For Brave Browser, you can simply copy paste them in the advance settings section.
// In gist.github of behroz_surfingkeys.js select =Raw=
// Copy the web-link of the gist.
// Go to Surfingkeys =Settings=, ticked the =Advanced mode=
// Paste the link of =Raw= gist file in the =Load Settings from=
// Save the settings. The gist contents should be transfered.
// Restart the browser.
// ~~~~~~~~~~~~~~~~~~~~~~~BEGIN
// settings.aceKeybindings = "emacs"; //c-x c-s to save+insert INPUT
settings.hintAlign = "center";
//settings.scrollStepSize = 30;
settings.tabsThreshold = 5; // When total of opened tabs exceeds, use omnibar then
settings.tabsMRUOrder = false; // Most Recently Used order
settings.scrollStepSize = 80; // Change to 100+ for faster scrolling
settings.scrollFriction = 0; // Set higher to make initial scroll steps
settings.focusFirstCandidate = true;
// ################
// Setting
settings.focusOnSaved = true; // Whether to focus text input after quitting from vim editor.
settings.omnibarMaxResults = 8; // How many results will be listed out each page for Omnibar.
settings.omnibarPosition = 'middle'; // Where to position Omnibar. ["middle", "bottom"]
settings.omnibarSuggestion = true; // Show suggestion URLs
settings.omnibarSuggestionTimeout = 200; // Timeout duration before Omnibar suggestion URLs are queried, in milliseconds. Helps prevent unnecessary HTTP requests and API rate-limiting.
settings.smoothScroll = true; // Whether to use smooth scrolling when pressing keys like j/k/e/d to scroll page or elements.
//settings.scrollStepSize = 100; // A step size for each move by j/k
//settings.defaultSearchEngine = 's'; // The default search engine used in Omnibar.
settings.focusAfterClosed = 'right'; // Which side of tab will be focused after current tab closed. ["left", "right"]
settings.tabsMRUOrder = true; // Whether to list opened tabs in order of most recently used beneath Omnibar.
settings.historyMUOrder = true; // Whether to list history in order of most used beneath Omnibar.
settings.newTabPosition = 'default'; // Where to new tab. ["left", "right", "first", "last", "default"]
//settings.stealFocusOnLoad = true; // Whether to prevent focus on input on page loaded, set to true by default so that we could use Surfingkeys directly after page loaded, otherwise we need press Esc to quit input.
settings.caseSensitive = false; // Whether finding in page is case sensitive.
settings.smartCase = true; // Whether to make caseSensitive true if the search pattern contains upper case characters.
settings.cursorAtEndOfInput = true; // Whether to put cursor at end of input when entering an input box, by false to put the cursor where it was when focus was removed from the input.
// ################
//Hints.characters = 'dfjkgheriunv';
//api.Hints.setCharacters('zqwertasd'); //less characters, more than 2 hint levels
// api.Hints.setCharacters('qwerasdfuojl'); //less characters, more than 2 hint levels
api.Hints.setCharacters('awersduojlf'); //less characters, more than 2 hint levels
// api.Hints.setCharacters('ersdfcvuo'); //less characters, more than 2 hint levels
// api.Hints.setCharacters('qwerasdf'); //less characters, more than 2 hint levels
// #####
api.unmap('ob'); // Change the "Omnibar" business to the `f` key
api.unmap('od');
api.unmap('og');
api.unmap('oh');
api.unmap('oi');
api.unmap('om');
api.unmap('on');
api.unmap('ow');
api.unmap('ox');
api.unmap('oy');
// (new_key, old_key)
// api.map('>_f', 'f');
// api.map('w', '>_f'); // Typical link jumping
// api.map('ao', 'T'); // shows and choose tabs to jump to
// close tab
api.map('gz', 'x');
// api.map('gk', 'x');
api.unmap('x'); // kill tab
// ####################### Insert Mode
api.imap("''", "<Ctrl-'>"); // press semicolon twice to toggle quote.
api.imap(',h', "<Ctrl-a>"); // Move the cursor to the beginning of the line
api.imap(',n', "<Ctrl-e>"); // Move the cursor to the end of the line
api.imap(',j', "<Alt-b>");
api.imap(',d', "<Ctrl-u>"); // Delete all entered characters before the cursor
api.imap(',e', "<Alt-w>"); // Delete a word backwards
api.imap(',r', "<Alt-d>"); // Delete a word forwards
api.imap(',i', "<Ctrl-i>"); // Open vim editor for current input
// api.imap('<k', "<Ctrl-Alt-i>");
// #######################
api.cmap('<Ctrl-n>', '<Tab>');
api.cmap('<Ctrl-p>', '<Shift-Tab>');
// #######################
api.map(".", "N");
api.map("-", "n"); // find next candidate
//api.unmap(">_n");
// #######################
//api.unmap('e');
api.map('gh', 'gg');
api.map('gn', 'G'); //
api.unmap('gg');
api.unmap('G');
//api.unmap('>_o');
// switch keys
// api.map('>_i', 'i'); // insert key
api.map('w', 'i'); // f as new insert
api.unmap('i');
// api.map('i', "<Esc>"); // press comma twice to leave current input box.
api.map('<Alt-f>', "<Esc>"); // press comma twice to leave current input box.
api.map('i', 'k'); //up
api.unmap('k'); //up
api.map('k', 'j'); //down
api.unmap('j'); //down
api.map('h', 'u'); //half-page-up
api.unmap('u'); //half-page-up
api.map('n', 'd'); //half-page-down
api.unmap('d'); //half-page-down
api.unmap('l');
api.map('j', 'E'); //left
api.map('l', 'R'); //tab on right
// api.map('e', 'R'); //tab on right
api.map('u', 'S'); //go back in history
api.map('ah', 'S'); //go back in history
api.unmap('o');
api.map('o', 'D'); //go forward in history
api.map('an', 'D'); //go forward in history
api.map('cn', '[['); //Click on the previous link on current page
api.map('cm', ']]'); //Click on the previous link on current page
// ''''''''''''''''''''''''
// visaul and caret mode
api.vmap("i", 'k'); //i -for up
// api.vunmap('>_k');
// api.vmap('k', '>_j'); //k -for down
// api.vunmap('>_j');
api.vmap('k', 'j'); //k -for down
//api.vunmap('j');
api.vmap('j', 'b'); //backward word
api.vmap('l', 'w'); //forward word
//api.vmap('>_-', '-');
api.vunmap('h');
api.vmap('h', '-'); //next found text
// api.vmap('>_.', '.');
api.vunmap('n');
api.vmap('n', '.'); //previous found text
// api.vmap('d')
// api.vunmap('>_.');
api.vmap('gh', 'gg'); ////backward documentboundary
api.vmap('gn', 'G'); //forward documentboundary
api.vunmap('gg');
api.vunmap('G');
api.vmap('d', '}'); //backward paragraph-boundary
api.vmap('e', '{'); //forward paragraph-boundary
//########################
api.vunmap('N'); //previous found text
api.vunmap('w'); //forward word
api.vunmap('b'); //backward word
api.vunmap('}'); //forward paragraph-boundary
api.vunmap('{'); //forward paragraph-boundary
api.vunmap(')'); //forward sentence
api.vunmap('('); //backward sentence
//########################
api.Hints.style('font-family: Input Sans Condensed, Charcoal, sans-serif; font-size: 11pt;', "hint");
// api.Hints.style('font-family: Input Sans Condensed, Charcoal, sans-serif; font-size: 12pt;', "text");
//########################
//########################
// set theme
settings.theme = `
.sk_theme {
font-size: 12pt;
background: #333333;
color: #abb2bf;
}
.sk_theme tbody {
color: #fff;
background: #e6e6fa;
}
.sk_theme input {
color: #d0d0d0;
}
.sk_theme .url {
color: #61afef;
}
#sk_keystroke {
color: #8b0000;
background: #9c9c9c;
}
.sk_theme kbd .candidates {
font-size: 13pt;
color: #8b0000;
background: #e6e6fa;
}
.sk_theme span.annotation {
color: #000000;
}
.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: #404040;
}
.sk_theme #sk_omnibarSearchResult ul li.focused {
background: #3e4452;
}
#sk_status, #sk_find {
font-size: 13pt;
}`;
// api.Hints.style(" text-align: center; vertical-align: middle; border: 1px solid #303030; border-radius: 80%; padding: 1px 2px; background: #d7af87; color: #000000; font-family: Input Sans Condensed, Charcoal, sans-serif; font-size:9pt;", "hint" );
// api.Hints.style(" text-align: center; vertical-align: middle; border: 1px solid #303030; border-radius: 20%; padding: 1px 1px; color: #000000; font-family: Input Sans Condensed, Charcoal, sans-serif; font-size: 10pt;", "hint" );
// ~~~~~~~~~~~~~~~~~~~~~~~END
// ~~~~~~~~~~~~~~~~~~~~~~~Sources & Acknowledgement_source
// Surfingkeys_Github_source: https://chadboyce.gitbook.io/notes/surfingkeys
// Acknowledgement_source: https://www.howardism.org/Technical/surfing-keys.js
// https://www.howardism.org/Technical/Emacs/browsing-in-emacs.html
// acknowledgment: https://gitlab.com/-/snippets/2098087
// acknowledgment: https://gitlab.com/-/snippets/1985201
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment