Use firefox in Emacs way

  |   Source

UPDATED: <2014-05-20 Tue>

CREATED: <2014-03-23 Sun>

I use keysnail. it's a firefox addon to convert firefox into Emacs.

I install keysnail's own plugins "HoK" and "Tanything".

Here are the use cases of keysnail.

Click & Copy the links

Install the HoK.

Insert below code into ~/.keysnail.js:

hook.setHook("PluginLoaded", function () {
    if (!plugins.hok) return;

    /* HoK 1.3.9+ required */
    plugins.hok.pOptions.selector = plugins.hok.pOptions.selector
    /* feedly */
    + ", *[data-uri]" + ", *[data-selector-toggle]" + ", *[data-page-action]" + ", *[data-app-action]"
    /* google plus */
    + ", *[guidedhelpid]"
    /* twitter */
    + ", *[data-item-count]";
});

key.setGlobalKey(["C-c","C-f"], function (aEvent, aArg) {
        ext.exec("hok-start-foreground-mode", aArg);
}, "Hok - Foreground hint mode", true);

key.setGlobalKey(["C-c","C-b"], function (aEvent, aArg) {
        ext.exec("hok-start-background-mode", aArg);
}, "HoK - Background hint mode", true);

key.setGlobalKey(["C-c","C-y"], function (aEvent, aArg) {
        ext.exec("hok-yank-foreground-mode", aArg);
}, "HoK - Background hint mode", true);

key.setGlobalKey(["C-c","C-;"], function (aEvent, aArg) {
        ext.exec("hok-start-extended-mode", aArg);
}, "HoK - Extented hint mode", true);

key.setGlobalKey(["C-c", "C-e"], function (aEvent, aArg) {
        ext.exec("hok-start-continuous-mode", aArg);
}, "Start continuous HaH", true);

Now I can press "Ctrl-C Ctrl-F" to select the links to click.

The links will be highlighted as below screen shot: keysnail-hok-nq8.png

I can press the highlighted hint to click the link.

Copy the link into clipboard is also easy. I press "C-c C-y" and similar UI will be displayed. I press the hint above to finish the operation.

Copy the text of link

This is my most favorite tool. As a developer, I need copy text of links from bug tracking software and paste it into git commit message frequently.

That's error prone because:

  1. The links are cluttered so it's hard to select the text of the link without actually clicking the link.
  2. The web UI of bug tracing system may use some CSS magic. Only part of the text of links are displayed. So it's impossible to select the text at all. For example, JIRA will display file name of "Screenshot 03/05/2014-193024.png" as "Screenshot 03/05/2014…png".

If you use keysnail+HOK, it's as simple as press hot key "C-c ; Y". That's it!

Switch tab

Install the Tanything.

Insert below code into ~/.keysnail.js:

key.setGlobalKey(["C-c", "C-a"], function (ev, arg) {
  ext.exec("tanything", arg);
}, "view all tabs", true);

Press "Ctrl-C Ctrl-A", you got below UI: keysnail-tanything-nq8.png

Tanything will locate the tab by finding match in web page's title or URL.

My keysnail set up

You can download my ~/.keysnail.js from HERE.

#+image/keysnail-hok-nq8.png wpid-keysnail-hok-nq8.png #+image/keysnail-tanything-nq8.png keysnail-tanything-nq8.png

Comments powered by Disqus