Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
surfin2.0
// surfingkeys conf
settings.hintAlign = "left" ;
settings.omnibarSuggestionTimeout = 500;
settings.showModeStatus = false;
iunmap(":"); // Disable emoji suggestions.
// settings.blacklistPattern = /.*mail.google.com.*|.*inbox.google.com.*/i;
settings.cursorAtEndOfInput = false;
settings.tabsMRUOrder = false;
settings.tabsThreshold = 18;
Hints.scrollKeys = "G";
addSearchAlias('L', 'Im feeling lucky', 'https://www.google.com/search?btnI=1&q=','w');
addSearchAlias('y', 'youtube', 'https://www.youtube.com/results?search_query=');
addSearchAlias('a', 'Amazon', 'http://www.amazon.co.jp/s/?field-keywords=');
addSearchAlias('w', 'Wikipedia Inglés', 'http://www.wikipedia.org/w/index.php?title=Special:Search&search=');
addSearchAlias('i', 'Google Img', 'https://www.google.com.ar/search?site=imghp&tbm=isch&source=hp&biw=1478&bih=740&q=');
addSearchAlias('map', 'Google Maps', 'https://www.google.com.ar/maps/search/');
addSearchAlias('im', 'IMDB', 'http://www.imdb.com/find?s=all&q=');
addSearchAlias('tp', 'Pirate Bay search', 'https://thepiratebay.org/search/');
// Unmap undesired defaults
const unmaps = [
"ob", "d", "u", "a", "s","h", "l",
"ow", "cp", ";cp",
"zz", "zR", "ab",
"Q", "q", "ag",
"af", ";s", "yp",
"<Ctrl-k>", "<Ctrl-j>",
"J", "K",
]
unmaps.forEach((u) => {
unmap(u)
})
//unmap('k', /(reddit|feedly|mail\.google)\.com/);
//unmap('j', /(reddit|feedly|mail\.google)\.com/);
mapkey('h', '#4Go back in history', function() {
history.go(-1);
}, {repeatIgnore: true});
mapkey('l', '#4Go forward in history', function() {
history.go(1);
}, {repeatIgnore: true});
map('<Ctrl-n>', 'R') // next tab
map('<Ctrl-p>', 'E') // prev tab
map("a", "E")
map("s", "R")
map("`", "T")
map('F', 'gf'); // open a link in new tab
// Disable surfingkeys for a second (allows for escaping application shortcuts)
mapkey('-', 'Escape', function() {
toggleBlacklistSilent();
setTimeout(function() { toggleBlacklistSilent(); }, 1000);
});
mapkey('yo', "#7Copy current page's URL & title in org-mode format", function() {
Clipboard.write('[[' + window.location.href + '][' + document.title + ']]');
});
// open URL from clipboard
mapkey('p', '#3Open URL from clipboard', () => {
Clipboard.read(response => {
window.location.href = response.data;
});
});
mapkey('P', '#1Open URL from clipboard in a new tab', () => {
Clipboard.read(response => {
window.open(response.data);
});
})
mapkey('gE', '#12 go Extensions - Open Chrome extensions Shortcut setting', function () {
tabOpenLink("chrome://extensions/shortcuts");
});
// qmarks
var overlayedGlobalMarks = {
'1': 'https://mail.google.com/mail/u/0/?tab=cm&zx=1a9kkuzmcil0m&shva=1#inbox',
'2': 'http://www.google.com/calendar',
'9': ['http://www.walla.co.il/', 'http://www.ynet.co.il/', 'http://www.haaretz.co.il/', 'http://sports.walla.co.il/', 'http://espn.go.com/', 'http://soccernet.espn.go.com/', 'http://www.cnn.com/', 'http://kde-apps.org/', 'http://kde-look.org/', 'https://www.reddit.com/r/Emacs', 'http://emacs.stackexchange.com/'],
'7': ['https://groups.google.com/forum/#!forum/mu-discuss','https://plus.google.com/u/0/', 'https://bbs.archlinux.org/viewforum.php?id=27'] ,
'3': 'https://www.google.com/contacts/#contacts',
'a': 'https://bbs.archlinux.org/viewforum.php?id=27',
'c': 'http://www.cnn.com',
'd': 'http://debuzzer.com/',
'e': 'http://espn.go.com/',
'x': 'https://paste.xinu.at/',
'F': 'http://10.0.0.55/',
'g': 'https://plus.google.com/u/0/',
'G': 'https://groups.google.com/forum/#!forum/beets-users',
'h': 'http://www.haaretz.co.il/',
'r': 'https://www.reddit.com/r/Emacs',
'k': 'https://rarbg.to/torrents.php',
'L': 'http://livetv.ru/en/',
'l': 'http://www.livescore.com',
'K': 'http://www.firstrowsports.eu/',
'm': 'https://maps.google.com/',
'o': 'http://sports.walla.co.il',
'p': 'http://emacs.stackexchange.com/',
'q': 'http://slickdeals.net/',
'4': 'http://10.0.0.2:8080/cgi-bin/',
'O': 'http://lists.gnu.org/archive/html/emacs-orgmode/',
's': 'http://www.espnfc.com',
'u': 'https://www.youtube.com/feed/subscriptions',
'5': 'http://10.0.0.2:9091/transmission/web/',
'U': 'https://github.com/zeltak',
'w': 'http://www.walla.co.il/',
'D': 'http://www.dropbox.com/',
'y': 'http://www.ynet.co.il/',
'R': 'http://in.bgu.ac.il/en/osr/Pages/Authority-Personnel.aspx',
'0': 'https://www.weather2day.co.il/beer-sheva',
'f': 'https://www.facebook.com',
'j': 'https://yabb.jriver.com/interact/index.php'
};
mapkey('gn', '#10Jump to vim-like mark in new tab.', function(mark) {
var priorityURLs = overlayedGlobalMarks[mark];
if (priorityURLs === undefined) {
// fallback to Surfingkeys default jump
Normal.jumpVIMark(mark, true);
return;
}
if (typeof priorityURLs == typeof "") {
priorityURLs = [priorityURLs]
}
for (var url of priorityURLs) {
var markInfo = {
url: url,
scrollLeft: 0,
scrollTop: 0
};
markInfo.tab = {
tabbed: true,
active: true
};
RUNTIME("openLink", markInfo);
}
});
mapkey('gh', '#10Jump to vim-like mark in current tab.', function(mark) {
var priorityURLs = overlayedGlobalMarks[mark];
if (priorityURLs === undefined) {
// fallback to Surfingkeys default jump
Normal.jumpVIMark(mark, true);
return;
}
if (typeof priorityURLs == typeof "") {
priorityURLs = [priorityURLs]
}
for (var url of priorityURLs) {
var markInfo = {
url: url,
scrollLeft: 0,
scrollTop: 0
};
markInfo.tab = {
tabbed: false,
active: false
};
RUNTIME("openLink", markInfo);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.