Skip to content

Instantly share code, notes, and snippets.

@haxscramper
Created March 19, 2018 08:44
Show Gist options
  • Save haxscramper/56ae6cc5331786045b7a352fa3184467 to your computer and use it in GitHub Desktop.
Save haxscramper/56ae6cc5331786045b7a352fa3184467 to your computer and use it in GitHub Desktop.
Setting for surfingkeys chrome extension
var remapArray =
[
[';', 'R'], // One tab right
['l', 'E'], //One tab left
[',', 'S'], //History back
['t', 'on'], // New Tab
['z', 'X'], // Restore closed tab
['.', 'D'], // History forward
['<', '<<'], // Move tab left
['>', '>>'], // Move tab right
['a', 'T'], // Show tabs summary
['mt', 'Q'], // Translation in omnibar
['N', 'W'], // New window with current tab
['e', 'gf'], // Open link in non-active tab
['ps', 'gs'], // View current page source
['pi','si'] // Open Chrome Inspect
];
map('d', 'af');
vmap(';', 'l');
vmap('l', 'h');
for (var i = 0; i < remapArray.length; i++) {
map(remapArray[i][0], remapArray[i][1]);
}
var unmapArray =
[
'S',
'D',
'X',
'gxt',
'on',
'T',
'E',
'R'
,'gxT',
'h',
'C',
'sw',
'sb',
'sd',
'<Ctrl-W>',
'<Ctrl-S>',
'<Ctrl-Shift-S>',
'<Ctrl-Shift-s>',
];
for (var i = 0; i < unmapArray.length; i++) {
unmap(unmapArray[i]);
}
settings.richHintKeystroke = 250;
settings.smoothScroll = false;
settings.newTabPosition = 'last';
settings.showModeStatus = true;
settings.enableAutpfocus = false;
Hints.characters = 'asdfjkl';
mapkey('[', 'Close tab on left', function() { RUNTIME("closeTabLeft"); }, {repeatIgnore: true});
mapkey(']', 'Close tab on right', function() { RUNTIME("closeTabRight"); }, {repeatIgnore: true});
mapkey('<Alt-p>', 'Toggle pin tab', function() { RUNTIME("togglePinTab"); });
self.togglePinTab = function(message, sender, sendResponse) {
chrome.tabs.query({currentWindow: true, active: true}, function(tabs) {
var tab = tabs[0];
return chrome.tabs.update(tab.id, {
pinned: !tab.pinned
});
});
};
addSearchAlias('s', 'searx', 'https://searx.me/?q=');
mapkey('ss', 'Search Selected with searx', function() {
searchSelectedWith("https://searx.me/?q=");
});
vmapkey('ss', 'Search Selected with searx', function() {
searchSelectedWith("https://searx.me/?q=");
});
if ( document.origin === "https://drive.google.com" ) {
unmapAllExcept(['[',']']);
}
@haxscramper
Copy link
Author

For up-to-date version see this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment