From c1623b38c2a8ee582f204c837130a0e945e07e09 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 3 Nov 2013 21:38:57 +0100 Subject: Update conkeror config --- conkeror/.conkerorrc/init.js | 83 ++++++++---------------- conkeror/.conkerorrc/site-js/quickdispatch.js | 33 ++++++++++ conkeror/.conkerorrc/themes/yoshi/minibuffer.css | 4 +- conkeror/.conkerorrc/themes/yoshi/mode-line.css | 7 +- 4 files changed, 68 insertions(+), 59 deletions(-) create mode 100644 conkeror/.conkerorrc/site-js/quickdispatch.js diff --git a/conkeror/.conkerorrc/init.js b/conkeror/.conkerorrc/init.js index 520ef04..94a84e9 100644 --- a/conkeror/.conkerorrc/init.js +++ b/conkeror/.conkerorrc/init.js @@ -4,10 +4,13 @@ require("session"); load_paths.push("file:///usr/local/clark/share/conkeror/modules/"); load_paths.push("file:///home/slash/projects/cdispass/"); +load_paths.push("file:///home/slash/.conkerorrc/site-js/"); +load_paths.push("file:///home/slash/.conkerorrc/clark-conkeror/"); theme_load_paths.push("/home/slash/.conkerorrc/themes/"); require("clark"); require("cdispass"); +require("quickdispatch"); define_browser_object_class( "history-url", null, @@ -93,6 +96,9 @@ define_webjump("php", define_webjump("python", "http://docs.python.org/search.html?q=%s&check_keywords=yes&area=default", $alternative="http://www.python.org"); +define_webjump("pypi", + "https://pypi.python.org/pypi?%3Aaction=search&term=%s&submit=search", + $alternative="https://pypi.python.org"); define_webjump("ddg", "https://duckduckgo.com/?q=%s", $alternative="https://duckduckgo.com"); @@ -100,7 +106,7 @@ define_webjump("metal-archives", "http://www.metal-archives.com/search?searchString=%s&type=band_name", $alternative="http://www.metal-archives.com"); define_webjump("djangodocs", - "https://docs.djangoproject.com/search/?q=%s&release=5", + "https://docs.djangoproject.com/search/?q=%s", $alternative="https://docs.djangoproject.com/"); define_webjump("google", "https://duckduckgo.com?q=!google%%20%s"); @@ -113,6 +119,8 @@ define_webjump("mdn", define_webjump("monsterhunter", "http://monsterhunter.wikia.com/wiki/index.php?search=%s&fulltext=Search", $alternative="http://monsterhunter.wikia.com/"); +define_webjump("quickdocs", "http://quickdocs.org/search?q=%s", + $alternative="http://quickdocs.org/"); // Archlinux define_webjump("arch/wiki", "https://wiki.archlinux.org/index.php?search=%s", @@ -157,13 +165,16 @@ title_format_fn = ext_title_format; url_remoting_fn = load_url_in_new_buffer; session_auto_save_auto_load = true; +define_key(content_buffer_form_keymap, "C-g", "unfocus"); define_key(content_buffer_normal_keymap, "C-x C-b", "switch-to-buffer"); +define_key(content_buffer_normal_keymap, "C-x C-f", "clark-find-url-new-buffer"); define_key(content_buffer_normal_keymap, "C-y", "paste-url-new-buffer"); define_key(content_buffer_normal_keymap, "H", "find-url-from-history"); -define_key(content_buffer_normal_keymap, "h", "find-url-from-history-new-buffer"); -define_key(default_base_keymap, "C-x f", "follow-new-buffer"); define_key(content_buffer_normal_keymap, "b", clark_keymap); +define_key(content_buffer_normal_keymap, "g", "clark-find-url"); +define_key(content_buffer_normal_keymap, "h", "find-url-from-history-new-buffer"); define_key(content_buffer_text_keymap, "C-c d", "dispass-and-submit"); +define_key(default_base_keymap, "C-x f", "follow-new-buffer"); add_hook("before_quit_hook", oni_before_quit_func); add_hook("content_policy_hook", content_policy_bytype); @@ -181,39 +192,6 @@ external_content_handlers.set("application/pdf", "zathura"); external_content_handlers.set("application/vnd.ms-excel", "libreoffice"); var gh_url = "http://github.com/"; -function read_url_github_ad_command_handler(input) -{ - var m = /^gh\s+@(\S+)(?:\s+((?:un)?follow))?/.exec(input); - if (m) { - if (m[2]) - return gh_url + "users/follow?target="; - return gh_url + m[1]; - } - - return null; -} - -function read_url_github_my_command_handler(input) -{ - var m = /^gh\s+my\s+(dashboard|issues|notifications|profile|pulls|stars)/.exec(input); - - if (m) { - switch (m[1]) { - case "dashboard": - case "notifications": - case "stars": - return gh_url + m[1]; - case "issues": - case "pulls": - return gh_url + "dashboard/" + m[1]; - case "profile": - return gh_url + "settings/" + m[1]; - } - } - - return null; -} - function read_url_github_repo_command_handler(input) { var m = /^gh\s+(\S+\/\S+)(?:\s+(\#\d+|\@\S+|issues|pulls|wiki|graphs|network|admin)(?:\s+(\#\d+|new))?)?$/.exec(input); @@ -261,28 +239,11 @@ function read_url_github_repo_command_handler(input) function read_url_github_command_handler(input) { - return read_url_github_ad_command_handler(input) - || read_url_github_my_command_handler(input) - || read_url_github_repo_command_handler(input); -} - -function read_url_local_port_handler(input) -{ - var m = /^lh (\d{1,5})(?:\s+([a-zA-Z0-9%/]+))?$/.exec(input), - rv = null; - - if (m) { - rv = "http://localhost:" + m[1]; - - if (m[2]) - rv += "/" + m[2]; - } - - return rv; + return read_url_github_repo_command_handler(input); } -read_url_handler_list = [read_url_local_port_handler, - read_url_github_command_handler]; +read_url_handler_list = [read_url_github_command_handler, + read_url_qd_handler]; // Mozrepl let (mozrepl_init = get_home_directory()) { @@ -313,3 +274,13 @@ register_user_stylesheet( oni_add_sheet("github.css"); oni_add_sheet("help.css"); oni_add_sheet("git-scm.css"); + +// Overwrite built-in one +function scroll_horiz_complete (buffer, n, y) { + var w = buffer.focused_frame; + w.scrollTo (n > 0 ? w.scrollMaxX : 0, y == null ? w.scrollY : y); +} + +interactive("scroll-top-left", + "Scroll the current frame all the way to the top left", + function (I) { scroll_horiz_complete(I.buffer, -1, 0); }); diff --git a/conkeror/.conkerorrc/site-js/quickdispatch.js b/conkeror/.conkerorrc/site-js/quickdispatch.js new file mode 100644 index 0000000..15fc63c --- /dev/null +++ b/conkeror/.conkerorrc/site-js/quickdispatch.js @@ -0,0 +1,33 @@ +define_variable("quickdispatch_prefix", "#", + "Prefix which indicates a quickdispatch URL."); +define_variable("quickdispatch_list", {}, + "List of key-value pairs representing the RegExp and" + + " replacement values for dispatches."); + +quickdispatch_list = + {"lh (\\d{1,5})(?:\\s+([a-z0-9%_/-]+))?$": "http://localhost:$1/$2", + "r ([a-zA-Z0-9_-]+)$": "http://reddit.com/r/$1", + "gh \\+([a-zA-Z0-9_-]+)$": "http://github.com/users/follow?target=$1", + "gh -([a-zA-Z0-9_-]+)$": "http://github.com/users/follow?target=$1", + "gh @([a-zA-Z0-9_-]*)$": "http://github.com/$1", + "ghw @([a-zA-Z0-9_-]+)$": "http://$1.github.io", + "gh ([a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+(?:/(pulls|wiki|graphs|network|admin))?)$": "http://github.com/$1", + "ghw ([a-zA-Z0-9_-]+)/([a-zA-z0-9_-]+)$": "http://$1.github.io/$2", + "gh my (dashboard|notifications|stars)$": "http://github.com/$1", + "gh my (issues|pulls)$": "http://github.com/dashboard/$1", + "gh my profile$": "http://github.com/settings/profile"}; + +function read_url_qd_handler(input) +{ + var keys = Object.keys(quickdispatch_list); + + for (var i = 0; i < keys.length; i++) { + var rx = new RegExp(quickdispatch_prefix + keys[i]); + if (rx.test(input)) + return input.replace(rx, quickdispatch_list[keys[i]]); + } + + return "http://example.com"; +} + +provide("quickdispatch"); diff --git a/conkeror/.conkerorrc/themes/yoshi/minibuffer.css b/conkeror/.conkerorrc/themes/yoshi/minibuffer.css index 12ca4e8..275e9fa 100644 --- a/conkeror/.conkerorrc/themes/yoshi/minibuffer.css +++ b/conkeror/.conkerorrc/themes/yoshi/minibuffer.css @@ -5,7 +5,7 @@ background-color: #111113; border: none; color: #EEEEEC; - font: 16px "Envy Code R"; + font: 16px "PT Mono"; } #minibuffer-input, #minibuffer-input * { @@ -27,7 +27,7 @@ tree.completions { background-color: #111113 !important; -moz-border-top-colors: -moz-initial !important; color: #EEEEEC !important; - font: 18px "Envy Code R"; + font: 18px "PT Mono"; } tree.completions treechildren::-moz-tree-row { diff --git a/conkeror/.conkerorrc/themes/yoshi/mode-line.css b/conkeror/.conkerorrc/themes/yoshi/mode-line.css index 31aabd7..81ba3f7 100644 --- a/conkeror/.conkerorrc/themes/yoshi/mode-line.css +++ b/conkeror/.conkerorrc/themes/yoshi/mode-line.css @@ -1,5 +1,5 @@ .mode-line { - font: 16px "Envy Code R"; + font: 16px "PT Mono"; padding: 0px; border: none; color: #EEEEEC; @@ -9,3 +9,8 @@ .mode-line label { color: #EEEEEC; } + +.mode-line .buffer-icon-widget { + max-height: 16px; + max-width: 16px; +} -- cgit v1.2.3-54-g00ecf