User Tools

Site Tools


michaelraskin

My config (Lisp-EM-based):

# How to bind
set bind = event bind command
set flashbind = event flash-bind command
set subscribe = event subscribe-event
set lisp = event lisp
set nowu = on-first uzbl
set asku = on-enter uzbl

# Needed for normal work
set proxy_url = http://127.0.0.1:3128
set shell_cmd = /bin/sh -c 
set fifo_dir = /tmp
set socket_dir = /tmp
@subscribe new-window chain / ; / on-first event run-command " " uzbl %s ; on-first even clear-keystr
set javascript_windows = 1

# Other schemes
set scheme_handler = event unknown_scheme %s

# Status bar
set show_status       = 1
set status_background = #303030
set status_format     = <span font_family="monospace"><span foreground="white">\@uzbl_extra_message</span><span background="khaki" foreground="black">[\@[\@MODE]\@][\@[\@scroll_message]\@]</span><span foreground="#a0a0a0"> \@[\@KB_SELECTED_URI\@SELECTED_URI]\@</span> [<span weight="bold" foreground="red">\@[\@keycmd]\@</span>] <span foreground="#606060"> \@[\@LOAD_PROGRESSBAR]\@ </span> <span foreground="khaki">\@[\@NAME]\@</span>   <span foreground="orange">\@status_message</span> <span foreground="#99FF66">\@[\@uri]\@</span></span>
set status_top        = 0
@bind t @nowu toggle_status
@subscribe load-commit uzbl set LOAD_PROGRESSBAR=will
@subscribe load-start uzbl set LOAD_PROGRESSBAR=ask
@subscribe load-progress uzbl set LOAD_PROGRESSBAR=%s%
@subscribe load-finish uzbl set LOAD_PROGRESSBAR=OK

event register_nocommand_mode insert

# Insert mode auto-control
@subscribe root-active chain | ; | on-first event mode command ; @nowu set forward_keys=0 ; @nowu set MODE=C
@subscribe form-active chain | ; | on-first event mode insert ; @nowu set forward_keys=1 ; @nowu set MODE=I

# Basic editing/mode support
@flashbind {BackSpace} uzbl event back-keystr
@flashbind {Escape} event clear-keystr
@flashbind {Return} event special-key enter
@bind i on-first event form-active
event flash-bind insert {Escape} event root-active
set MODE=C

# Font choice
set font_size = 11
set default_font_family = DejaVu Serif
set monospace_font_family = DejaVu Sans Mono
set cursive_font_family = DejaVu Sans
set sans_serif_font_family = DejaVu Sans
set serif_font_family = DejaVu Serif
set fantasy_font_family = DejaVu Serif
set monospace_size = 10
set minimum_font_size = 6 

# User agent
set useragent = Uzbl (WebKit Webkit @WEBKIT_MAJOR.@WEBKIT_MINOR.@WEBKIT_MICRO) ([@ARCH_UZBL]) (Commit @COMMIT) (Gecko compatible) (NixOS Linux distribution) (AppleWebkit if you prefer)
js navigator.userAgent = '@useragent'

# Change User agent
@bind \@ua{__} on-enter chain | ; | on-first uzbl set useragent=%s ; on-first uzbl js navigator.userAgent = \@useragent

# Core functionality bindings
@bind o{__} @asku set uri=%s
@bind zz @nowu exit

# Scrolling
@bind j @nowu scroll vertical 20
@bind k @nowu scroll vertical -20
@bind J @nowu scroll vertical 200
@bind K @nowu scroll vertical -200
@bind h @nowu scroll horizontal -20
@bind l @nowu scroll horizontal 20
@bind H @nowu scroll horizontal -400
@bind L @nowu scroll horizontal 400
@bind << @nowu scroll vertical -100000%
@bind >> @nowu scroll vertical +100000%
@bind {Page_Up} @nowu scroll vertical -100%
@bind {Page_Down} @nowu scroll vertical +100%

# Navigation
@bind b @nowu back
@bind m @nowu forward
@bind s @nowu stop
@bind r @nowu reload
@bind R @nowu reload_ign_cache
@bind [{Ctrl}r] @nowu set uri=@uri

# Zoom
@bind + @nowu zoom_in 
@bind - @nowu zoom_out
@bind T @nowu toggle_zoom_type
@bind 1 @nowu set zoom_level = 1.0
@bind 2 @nowu set zoom_level = 2.0

# Search
@bind / each-key chain / ; / each-key uzbl search %s ; on-enter event clear-keystr
@bind ? each-key chain / ; / each-key uzbl search_reverse %s ; on-enter event clear-keystr
@bind \\ @asku search %s
@bind n @nowu search
@bind N @nowu search_reverse

# Basic bookmarks
@bind gh @nowu set uri=http://www.uzbl.org/
@bind gb @nowu set uri=http://127.0.0.1/~$USER/bookmarks.html

# Open relative url
@bind O{__} @asku js window.location = "%s";

# Clipboard handling
@bind p on-first uzbl-raw set uri = \@(xclip -selection primary -o)\@
@bind P on-first uzbl-raw set uri = \@(xclip -selection clipboard -o)\@
@subscribe to-clipboard chain | -;;- | on-first shell "," sh,-c,echo -n "%s" | xclip -i -selection primary -;;- on-first shell "," sh,-c,echo -n "%s" | xclip -i -selection secondary -;;- on-first shell "," sh,-c,echo -n "%s" | xclip -i -selection clipboard
@bind yurl on-first event to-clipboard \@uri

# Clone instance
@bind yyp on-first uzbl-raw event new_window \@uri

# Dump config; reload config; restart an instance
@bind !dump @nowu dump_config
@bind !reload on-first shell cat $HOME/.config/uzbl/config > /tmp/uzbl_fifo_\$uzbl_id
@bind !hotswap on-first chain | ; | on-first shell "," sh,-c,uzbl \$uzbl_uri & disown ; @nowu exit

# Search bookmarks
@bind \@fm{__} @asku set uri = http://freshmeat.net/search?q=%s
@bind \@sf{__} @asku set uri = http://sourceforge.net/search/?type_of_search=soft&words=%s
@bind \@fsd{__} @asku set uri = http://directory.fsf.org/search/?query=%s
@bind \@wpen{__} @asku set uri = http://en.wikipedia.org/w/index.php?title=Special:Search&search=%s&go=Go
@bind \@wpru{__} @asku set uri = http://ru.wikipedia.org/w/index.php?search=%s
@bind \@ya{__} @asku set uri = http://yandex.ru/yandsearch?rpt=rad&text=%s
@bind \@r0{__} @asku set uri = http://nova.rambler.ru/search?query=%s
@bind \@clusty{__} @asku set uri = http://clusty.com/search?query=%s
@bind \@sec{__} @asku set uri = http://secunia.com/search/?search=%s
@bind \@rubook{__} @asku set uri = http://www.poiskknig.ru/cgi-bin/poisk.cgi?lang=ru&st=%s&network=1
@bind \@abbr{__} @asku set uri = http://www.abbreviations.com/%s
@bind \@urban{__} @asku set uri = http://www.urbandictionary.com/define.php?term=%s
@bind \@revo{__} @asku set uri = http://reta-vortaro.de/cgi-bin/sercxu.pl?sercxata=%s
@bind \@dpkg{__} @asku set uri = http://packages.debian.org/%s
@bind \@rfc{__} @asku set uri = ftp://ftp.rfc-editor.org/in-notes/rfc%s.txt
@bind \@scirus{__} @asku set uri = http://www.scirus.com/srsapp/search?q=%s&t=all&sort=0&g=s
@bind \@cve{__} @asku set uri = http://www.google.com/custom?sitesearch=cve.mitre.org&q=%s
@bind \@gnusw{__} @asku set uri = http://www.gnu.org/software/%s
@bind \@gg{__} @asku set uri = http://groups.google.com/group/%s
@bind \@cc{__} @asku set uri = http://clusty.com/search?query=%s
@bind \@mc{__} @asku set uri = http://www.metacrawler.com/metacrawler/web/%s
@bind \@snap{__} @asku set uri = http://www.snap.com/classicsearch.php?query=%s
@bind \@google _ = http://www.google.com/search?q=%s
@bind \@clnet{__} @asku set uri = http://common-lisp.net/project/%s
@bind \@cliki{__} @asku set uri = http://www.cliki.net/%s
@bind \@?cliki{__} @asku set uri = http://www.cliki.net/admin/search?words=%s
@bind \@rsdn{__} @asku set uri = http://img.meta.ua/rsdnsearch/?q=%s
@bind \@fdt{__} @asku set uri = http://%s.freedesktop.org
@bind \@us{__} @asku set uri = http://userscripts.org/scripts/search?q=%s
@bind \@trope{__} @asku set uri = http://tvtropes.org/pmwiki/pmwiki.php/Main/%s
@bind \@meme{__} @asku set uri = http://knowyourmeme.com/search/memes?q=%s
@bind \@citeseer{__} @asku set uri = http://citeseer.ist.psu.edu/cis?q=%s
@bind \@lurk{__} @asku set uri = http://lurkmore.ru/%s
@bind \@so{__} @asku set uri = http://stackoverflow.com/search?q=%s
 
# Code running 
@bind \@js{__} @asku js %s
@bind \@cmd{__} @asku %s
@bind \@cmd-raw{__} on-enter uzbl-raw %s
@bind \@ev{__} on-enter event %s
@bind \@lisp{__} on-enter lisp (eval (read-from-string param))
@bind \@set{__} @asku set %s

# Loading of JS
set usload=script $HOME/public_html/userscript/
set lsload=script $HOME/.local/share/uzbl/scripts/
@bind \@jsload{__} @asku script %s
@bind \@usload{__} @asku @usload%s.js
@bind \@lsload{__} @asku @lsload%s.js

# Periodic reload 
@bind \@reload{__} on-enter shell "," sh,-c,{ while test -e /tmp/uzbl_fifo_\$uzbl_id ; do echo reload > /tmp/uzbl_fifo_\$uzbl_id ; sleep %s; done }

# Bookmarks
@bind '/.' @nowu set uri =  http://slashdot.org/
@bind 'on' @nowu set uri = http://opennet.ru/
@bind 'lor' @nowu set uri = http://linux.org.ru/
@bind 'nyr' @nowu set uri = http://news.yandex.ru/
@bind 'dev' @nowu set uri = https://dev.mccme.ru/login/ 
@bind 'mfsms' @nowu set uri =  http://sms.megafonmoscow.ru/?from=first
@bind 'mtssms' @nowu set uri =  http://sms.mts.ru/
@bind 'beesms' @nowu set uri =  http://www.beonline.ru/portal/comm/send_sms/simple_send_sms.sms
@bind 'als' @nowu set uri =  http://www.artlebedev.ru/
@bind 'lq' @nowu set uri =  http://www.linuxquestions.org/
@bind 'lqs' @nowu set uri =  http://www.linuxquestions.org/questions/subscription.php
@bind 'w3c' @nowu set uri =  http://w3c.org/
@bind 'us' @nowu set uri =  http://userscripts.org/
@bind 'clhs' @nowu set uri =  http://www.lispworks.com/documentation/HyperSpec/Front/index.htm
@bind 'hydra' @nowu set uri =  http://hydra.nixos.org/queue
@bind 'acid3' @nowu set uri =  http://acid3.acidtests.org
@bind 'lkws' @nowu set uri =  http://kernel.org/
@bind 'nwk' @nowu set uri =  http://nightly.webkit.org/
@bind 'bwk' @nowu set uri =  http://bugs.webkit.org/
@bind 'tldp' @nowu set uri =  http://tldp.org
@bind 'ith' @nowu set uri = http://ithappens.ru/
@bind 'ium' @nowu set uri = http://ium.mccme.ru/
@bind 'pgsql' @nowu set uri = http://www.postgresql.org/docs/8.4/interactive/index.html
@bind 'rsr' @nowu set uri = https://rsr-olymp.ru/
@bind 'zu' @nowu set uri = http://zooniverse.org/projects 

# Micro hack-scripts for comfortable browsing/development
@bind 'fbug' @nowu js var firebug=document.createElement('script');firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug);
@bind 'removeWidth' @nowu js uzbl_killWidthAttribute=function(x) { if(x.children) { x.removeAttribute('width'); for (y in x.children) uzbl_killWidthAttribute(x.children[y]);};}; uzbl_killWidthAttribute(document.documentElement);
@bind 'saveURL' on-first chain | ; | on-first shell "," sh,-c,echo "\$uzbl_uri" >> "$XDG_DATA_HOME/uzbl/saved-urls" ; @nowu exit
@bind 'frames' @nowu js var x=document.createElement('script'); x.setAttribute('src','http://127.0.0.1/~$USER/userscript/mark-iframes.js'); document.body.appendChild(x); 
@bind 'killStyle' @nowu js uzbl_killStyle=function(x) { if(x.children) { x.removeAttribute('style'); x.removeAttribute('class'); for (y in x.children) uzbl_killStyle(x.children[y]);};}; uzbl_killStyle(document.documentElement); uzbl_killHead = function () {var de = document.documentElement; var i; for (i in de.children) { var c = de.children[i]; if (c.tagName.toUpperCase()=="HEAD") de.removeChild(c);};}; uzbl_killHead();
@bind 'ks' @nowu js uzbl_killStyle=function(x) { if(x.children) { x.removeAttribute('style'); x.removeAttribute('class'); for (y in x.children) uzbl_killStyle(x.children[y]);};}; uzbl_killStyle(document.documentElement); uzbl_killHead = function () {var de = document.documentElement; var i; for (i in de.children) { var c = de.children[i]; if (c.tagName.toUpperCase()=="HEAD") de.removeChild(c);};}; uzbl_killHead();
@bind 'focusflash' @nowu js document.location=document.getElementsByTagName("embed")[0].src
@bind 'sendsrc' @nowu js xh = new XMLHttpRequest(); xh.open("POST","http://127.0.0.1:9999"); xh.send(document.documentElement.outerHTML);
@bind 'l' on-first chain | -;;- | @nowu spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh load -;;- on-first lisp (sleep 0.5) -;;- @nowu js x=document.getElementsByTagName('input'); y=[]; n=0; for (i in x) { if (x[i].type == "submit") { y[n] = x[i]; n+=1; } }; x=[]; for(i in y) {x[i]=y[i]}; y=[]; n=0; for(i in x) { if ((x[i].value.toLowerCase() =="login") || (x[i].value.toLowerCase() =="sign in") || (x[i].value.toLowerCase() == "log in") || (x[i].name.toLowerCase() == "login") || (x[i].name.toLowerCase() == "submit_login")) {x[i].click()} }
@bind 'gb' @nowu set useragent = Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

# Form filling 
@bind Fn @nowu spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh new
@bind Fe @nowu spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh edit
@bind Fl @nowu spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh load

# History is best managed with Vim
@bind OO on-first shell "," sh,-c,urxvt -e vim $HOME/.local/share/uzbl/input-history; ( echo -n 'set uri = '; tail -1 $HOME/.local/share/uzbl/input-history  | sed -e 's/.*##//' ) > /tmp/uzbl_fifo_\$uzbl_id;
@bind oo on-first shell "," sh,-c,( echo -n 'set uri = '; tail -1 $HOME/.local/share/uzbl/input-history  | sed -e 's/.*##//' ) >  /tmp/uzbl_fifo_\$uzbl_id;
@bind Oo on-first shell "," sh,-c,echo "\$uzbl_uri" >> $HOME/.local/share/uzbl/input-history; urxvt -e vim $HOME/.local/share/uzbl/input-history; ( echo -n 'set uri = '; tail -1 $HOME/.local/share/uzbl/input-history | sed -e 's/.*##//' ) >  /tmp/uzbl_fifo_\$uzbl_id;

# Structure navigation
@bind [{Ctrl}{Up}] @nowu @lsload/structure/up.js
@bind [{Ctrl}{Right}] @nowu js (function () { var found = location.href.match(/(.*?)(\\d+)([^\\d]*)$/); if (found) { location = found[1] + (Number(found[2]) + 1) + found[3]; }})()
@bind [{Ctrl}{Left}] @nowu js (function () { var found = location.href.match(/(.*?)(\\d+)([^\\d]*)$/); if (found && found[2] != "0") { location = found[1] + (Number(found[2]) - 1) + found[3]; }})()


@flashbind [{Ctrl}w] uzbl exit
event flash-bind insert [{Ctrl}w] uzbl exit

@subscribe load-start chain / ; / @nowu event key-press Escape ; @nowu event key-release Escape

# Link following
set follow_hint_keys = fgjhdksla;
@bind fl each-key chain / ; / on-enter event clear-keystr ; each-key uzbl @lsload/jake-follower.js '@{follow_hint_keys} %s'
@bind fi each-key chain / ; / each-key uzbl @lsload/jake-follower.js '@{follow_hint_keys} %s' ; on-enter event form-active
@bind fn each-key chain / ; / on-enter event clear-keystr ; each-new-key uzbl @lsload/jake-follower.js '@{follow_hint_keys} new %s'
@bind f- on-first chain / ; / on-first uzbl @lsload/jake-follower.js '@{follow_hint_keys} clear' ; on-first event link_chosen
@bind fh each-key chain / ;; / once-preserving uzbl @lsload/jake-follower.js '@{follow_hint_keys} ' ;; each-key uzbl-raw event link_chosen \@<followLinks('%s', 1)>\@ ;; on-enter uzbl @lsload/jake-follower.js '@{follow_hint_keys} clear ' ;; on-enter uzbl event link_chosen ;; on-enter event clear-keystr 
@subscribe link-chosen uzbl set KB_SELECTED_URI=%s
@bind fy each-key chain / ;; / once-preserving uzbl @lsload/jake-follower.js '@{follow_hint_keys} ' ;; each-key uzbl-raw event to-clipboard \@<followLinks('%s', 1)>\@ ;; on-enter uzbl @lsload/jake-follower.js '@{follow_hint_keys} clear ' ;; on-enter event clear-keystr 
@bind fs on-first uzbl @lsload/follow-selection.js
@bind fc each-key chain / ;; / on-first uzbl js function followLinksClickCallback(item){item.click();} ;; on-first uzbl @lsload/jake-follower.js '@{follow_hint_keys} ' ;; each-key uzbl js followLinks('%s', true) ;; on-enter uzbl @lsload/jake-follower.js '@{follow_hint_keys} callback %s' ;; on-enter uzbl @lsload/jake-follower.js '@{follow_hint_keys} clear ' ;; on-enter uzbl event clear-keystr

# Bindings that depend on nothing and allow you to reset keyboard input state
event immortal-bind {Pause} chain / ;; / on-first uzbl js alert("Force reset!") ;; on-first event clear-keystr ;; on-first event mode command ;; on-first event root-active
event immortal-bind {Break} chain / ;; / on-first uzbl js alert("Force reset!") ;; on-first event clear-keystr ;; on-first event mode command ;; on-first event root-active

# User scripts
@subscribe load-finish lisp (uzbl-fmt-command "@usload~a.user.js" (third (cl-ppcre:split "/" param)))
@subscribe load-finish uzbl @usload universal.user.js

# Middle click
@flashbind {Button2} uzbl-raw event new-window \@SELECTED_URI

# History
@subscribe load-finish lisp (with-open-file (f (concatenate 'string (getenv "XDG_DATA_HOME") "/uzbl/uzbl.history") :direction :output :if-exists :append :external-format :utf-8) (format f "~a ~a ~a~%" (get-universal-time) (gethash "uri" *uzbl-vars*) (gethash "title" *uzbl-vars*)))

# Handling downloads 
@subscribe download-request lisp (uzbl-fmt-command "event link-~a ~a" (cl-ppcre:regex-replace-all ":.*" param "") param)
@subscribe load-error lisp (when (cl-ppcre:scan " 15:" param) (uzbl-fmt-command "event link-~a ~a" (cl-ppcre:regex-replace-all ":.*" param "") (first (split-by param #\\Space))))
# Unfortunately, cannot see the actual URL that way
#@subscribe unknown-scheme lisp (uzbl-fmt-command "event link-~a ~a" (cl-ppcre:regex-replace-all ":.*" param "") param)
set dldir=$HOME/.local/downloads
@bind \@dlto @asku set dldir=%s
@subscribe link-http shell "!" wget!-P!${dldir}!%s
@subscribe link-https shell "!" wget!-P!${dldir}!%s
@subscribe link-ftp shell "!" wget!-P!${dldir}!%s
michaelraskin.txt · Last modified: 2016/08/31 14:10 (external edit)