Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
my surfingkeys.js (google chrome surfingkeys extension configuration)
// 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).');
});
// an example to replace `T` with `gt`, click `Default mappings` to see how `T` works.
// map('gt', 'T');
// an example to remove mapkey `Ctrl-i`
unmap('<Ctrl-i>');
//unmap('h');
//unmap('l');
// my settings
// open tabs
map(';f', 'gf');
map(';r', 'cf');
// history
map('<Alt-h>', 'S');
map('<Alt-l>', 'D');
// map keys for setting escape
// NOTE: These mappings do not work in surfingkeys settings editor
// ctrl has to be used for vim mode
aceVimMap('<C-h>','<Esc>h','insert');
aceVimMap('<C-j>','<Esc>j','insert');
aceVimMap('<C-k>','<Esc>k','insert');
aceVimMap('<C-l>','<Esc>l','insert');
// Alt can be used in regular vield boxes (to exit the input box)
imap('<Alt-h>', '<Esc>');
imap('<Alt-j>', '<Esc>');
imap('<Alt-k>', '<Esc>');
imap('<Alt-l>', '<Esc>');
// visual mode NOT WORKING
// see: [Possible to map 'Ctrl-[' to 'Esc' in "Find" mode? · Issue #887 · brookhong/Surfingkeys](https://github.com/brookhong/Surfingkeys/issues/887)
// vmap('<Alt-h>', '<Esc>');
// vmap('<Alt-j>', '<Esc>');
// vmap('<Alt-k>', '<Esc>');
// vmap('<Alt-l>', '<Esc>');
// This WORKS for exiting visual / find mode
map('<Ctrl-]>', '<Esc>');
// navigate tabs
// tab next
map('J', 'E');
map('gt', 'R');
//tab prev
map('K', 'R');
map('gT', 'E');
//mapkey('J', '#3Go one tab left', 'RUNTIME("previousTab")');
//mapkey('K', '#3Go one tab right', 'RUNTIME("nextTab")');
mapkey('<Alt-,>', '#3Move current tab to left', function() {
RUNTIME('moveTab', {
step: -1
});
});
mapkey('<Alt-j>', '#3Move current tab to left', function() {
RUNTIME('moveTab', {
step: -1
});
});
mapkey('<Alt-.>', '#3Move current tab to right', function() {
RUNTIME('moveTab', {
step: 1
});
});
mapkey('<Alt-k>', '#3Move current tab to right', function() {
RUNTIME('moveTab', {
step: 1
});
});
// clipboard
map('yt', 'yl');
//copy page title and url in markdown format to clipboard
mapkey('yY', '#7Copy page title and url as markdown', function() {
Clipboard.write('['+document.title+']'+'('+window.location.href+')' );
});
// end my settings
// set theme
settings.theme = `
.sk_theme {
background: #000;
color: #fff;
}
.sk_theme tbody {
color: #fff;
}
.sk_theme input {
color: #d9dce0;
}
.sk_theme .url {
color: #2173c5;
}
.sk_theme .annotation {
color: #38f;
}
.sk_theme .omnibar_highlight {
color: #fbd60a;
}
.sk_theme ul>li:nth-child(odd) {
background: #1e211d;
}
.sk_theme ul>li.focused {
background: #4ec10d;
}`;
// click `Save` button to make above settings to take effect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment