Skip to content

Instantly share code, notes, and snippets.

@lesteve
Last active February 6, 2022 09:25
Show Gist options
  • Save lesteve/cec610ffc0bd41a91b9095673a12a665 to your computer and use it in GitHub Desktop.
Save lesteve/cec610ffc0bd41a91b9095673a12a665 to your computer and use it in GitHub Desktop.
Surfingkeys setup
settings.hintAlign = 'left';
settings.defaultSearchEngine = 'd';
// vimium-like settings
api.map("J", "E");
api.map("K", "R");
api.map("H", "S");
api.map("L", "D");
// from https://gist.github.com/chroju/2118c2193fb9892d95b9686eb95189d2
api.mapkey('p', 'Open URL from clipboard', function() {
Clipboard.read(function(response) {
console.log(response)
var markInfo = {
scrollLeft: 0,
scrollTop: 0
};
markInfo.tab = {
tabbed: false,
active: false
};
if (response.data.indexOf(".") != -1) {
markInfo.url = response.data;
} else {
markInfo.url = "https://duckduckgo.com/?q=" + encodeURIComponent(response.data);
}
RUNTIME("openLink", markInfo)
});
});
api.mapkey('P', 'Open URL from clipboard in new tab', function() {
Clipboard.read(function(response) {
console.log(response)
var markInfo = {
scrollLeft: 0,
scrollTop: 0
};
markInfo.tab = {
tabbed: true,
active: true
};
if (response.data.indexOf(".") != -1) {
markInfo.url = response.data;
} else {
markInfo.url = "https://duckduckgo.com/?q=" + encodeURIComponent(response.data);
}
RUNTIME("openLink", markInfo)
});
});
// omnibar shortcuts
// Use Alt-j rather than Ctrl-j for moving omnibar out of the way
api.cmap('<Alt-j>', '<Ctrl-j>')
// Use Ctrl-j/k to move up and down
api.cmap('<Ctrl-j>', '<Tab>');
api.cmap('<Ctrl-k>', '<Shift-Tab>');
// disable emoji completion (two emoji completer popups with conflicting suggestions
// on some websites, e.g. github, Discourse, ...)
api.iunmap(":");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment