Genki-S / dotfiles

My lovely settings.
22 stars 1 forks source link

question about your surfingkeys.js config #1

Closed zeltak closed 6 years ago

zeltak commented 6 years ago

Hi

just saw your fantastic surfingkeys.js config on github and loving it! (im also a fellow emacs user :) )

I have a short question on your great qmarks code this works great for opening 1 link at a time, that is:

 'm': 'https://mail.google.com',

but what if one would want to open a series of link with 1 quickmark

ie

'm': 'https://mail.google.com','cnn.com'

is there a way to do so? i cant really code so any examples would be great

thx so much in advance!!

Genki-S commented 6 years ago

Hi, thanks for your kind words and interesting idea :)

The following worked for me:

var overlayedGlobalMarks = {
    'm': ['https://mail.google.com', 'https://edition.cnn.com/'],
    'n': 'http://www.nicovideo.jp/ranking?header',
    's': 'https://www.google.com/calendar/render?pli=1',
    'r': 'http://feedly.com/#my',
    'a': 'http://www.amazon.co.jp/',
    'g': 'https://github.com/',
    't': 'https://twitter.com/',
    'y': 'https://youtube.com/',
    'p': 'http://getpocket.com/a/queue/'
};
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);
    }
});

Hope this helps.

zeltak commented 6 years ago

thx so much thats perfect!

zeltak

On Tue, Aug 28, 2018 at 3:57 PM Genki Sugimoto notifications@github.com wrote:

Hi, thanks for your kind words and interesting idea :)

The following worked for me:

var overlayedGlobalMarks = { 'm': ['https://mail.google.com', 'https://edition.cnn.com/'], 'n': 'http://www.nicovideo.jp/ranking?header', 's': 'https://www.google.com/calendar/render?pli=1', 'r': 'http://feedly.com/#my', 'a': 'http://www.amazon.co.jp/', 'g': 'https://github.com/', 't': 'https://twitter.com/', 'y': 'https://youtube.com/', 'p': 'http://getpocket.com/a/queue/' }; 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); } });

Hope this helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genki-S/dotfiles/issues/1#issuecomment-416574282, or mute the thread https://github.com/notifications/unsubscribe-auth/AAea6voPosnjCpauCQ7xzzRpF4sytRDAks5uVT5RgaJpZM4WI3Dg .