Skip to content

Instantly share code, notes, and snippets.

@sam33r
Last active December 4, 2021 12:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sam33r/ef1212975ab9f7aa8c7f48331716d149 to your computer and use it in GitHub Desktop.
Save sam33r/ef1212975ab9f7aa8c7f48331716d149 to your computer and use it in GitHub Desktop.
Surfingkeys Config
// Mappings
// --------
// 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).');
//});
cmap('<Ctrl-j>', '<Tab>');
cmap('<Ctrl-k>', '<Shift-Tab>');
// All global un-mappings go here.
for (let k of [ "ZQ" ]) { unmap(k); }
// click `Save` button to make above settings to take effect.
// set theme
//mapkey('H', 'Go back in history', history.go(-1));
//mapkey('L', 'Go forward in history', 'history.go(1)');
map('?', 'u');
map('u', 'e');
map('H', 'S');
map('L', 'D');
map('F', 'cf');
// Settings
// --------
settings.showModeStatus=true;
settings.richHintsForKeystroke=true;
settings.omnibarPosition="middle";
settings.modeAfterYank="Normal";
settings.focusFirstCandidate=false;
settings.historyMUOrder=false;
// Hints.characters="asdfghjkl";
settings.theme = `
}`;
// Disable emoji
iunmap(":");
// Search Engines
// --------------
removeSearchAliasX('w');
addSearchAliasX('w', 'Wikipedia', 'https://en.wikipedia.org/w/index.php?search=', 's', 'https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=', function(response) {
var res = JSON.parse(response.text);
Omnibar.listWords(res[1]);
});
removeSearchAliasX('b');
// Unmap everything other than the features I actually use.
unmapAllExcept([
'<Alt-s>',
'.',
// open links and edit fields
'f',
'F',
'i',
'I',
// change frame or scroll target
'w',
'cs',
// scrolling
'0', '$',
'gg','G',
'h','j','k','l',
'u','d',
// zoom
'zi','zo','zr',
// navigate, close and reopen tabs.
'T','x','X',
// navigate history
'H','L', 'S', 'D', 'oh',
// reload
'r',
// search
'sg','sw','og','ow',
// clipboard
'yy','yg', 'yG', 'yS','ya','yma',
// omnibar
'go', 'ox', 'b',':','<Ctrl-j>','<Ctrl-k>','<Ctrl-d>','<Ctrl-r>','<ArrowUp>','<ArrowDown>',
// visual
'v','V', '/','*','n','N',
// marks
'm',
// settings
'se',
// chrome urls
'si','gh','gd','ge', 'gb',
// pdf
';s',
// read?
'gr'
])
// Site-specific mappings.
// -----------------------
if (window.location.origin === "https://news.google.com") {
unmap('j');
unmap('k');
}
if (window.location.origin === "https://mail.google.com") {
unmap('j');
unmap('k');
unmap('x');
unmap('c');
unmap('r');
unmap('m');
}
// Theme
settings.theme = '\
#sk_status, #sk_find { \
font-size: 15pt; \
font-family: Consolas, monospace; \
background: #fff; \
color: #000; \
height: 25px; \
opacity: 0.7; \
} \
.sk_theme { \
font-family: Consolas, monospace; \
} \
';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment