Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

158 lines (123 sloc) 7.031 kB
"2.3.1 (created: 2010/04/07 18:25:13)
" delete any previously defined autocommands in this context
autocmd!
set mapleader=','
set urlseparator='\|'
set guioptions+=N
set! browser.dom.window.dump.enabled=true
set! devtools.errorconsole.enabled=true
" do not activate middle- or ctrl-clicked links
set activate-=links
" search shortcuts (without completion)
command! -nargs=* gg open google <args>
map s :gg<Space>
nmap s :gg<Space>
vmap s :gg<Space>
" command to clear history
" command! clearhist sanitize commandline
" Esc: abort request
noremap <Esc> <C-c><Esc>
noremap <F1> :tab<Space>:help<Space>
" prev/next for german keyboard layout
nmap -s -b ö [[
nmap -s -b ä ]]
" next/prev as single word is rather weak!
set previouspattern='^voriges Angebot$',^<$,^<(?!<),[^<]<$,'^prev|previous|früher|zurück$','vorige Seite|next page',^(<<|«|‹)$,^«,«$,^‹,'\bprev|previous|zurück\b'
set nextpattern='^nächstes Angebot$',^>$,^>(?!>),[^>]>$,'\bvor(wärts)?\b','^next|more|weiter|später$','nächste Seite|next page',^(>>|»|›)$,^»,»$,›$,'\bnext|more|weiter\b'
set popups=tab,resized
" A builtin bit.ly shortener.
" Based on http://github.com/scy/dotscy/commit/4526f23a09b2ae51fb7f4b1e2ed3aec84f318fa5
javascript <<EOF
function shortenURLBitLy (url) {
var req = new XMLHttpRequest();
req.open("GET", "http://api.bit.ly/v3/shorten?login=blueyed&apiKey=R_a405dd06737e888ca6971b295b0b7a13&format=txt&longUrl=" + encodeURIComponent(url), true)
req.onreadystatechange = function (ev) {
if (req.readyState == 4) {
if (req.status == 200) {
dactyl.clipboardWrite(req.responseText.replace(/\s+$/, ''), true);
} else {
dactyl.echo(req.responseText);
}
}
}
req.send(null);
}
EOF
map -silent gy -js shortenURLBitLy(buffer.URL)
" Firefox Sync: connect+sync on startup, sync on exit (does not appear to work)
" NOTE: gets triggered when opening a new window, too. With some Sync UI again in the status bar, this is not necessary anymore.
"autocmd VimperatorEnter .* emenu Tools.Sync.Connect
"autocmd VimperatorEnter .* emenu Tools.Sync.Sync Now
"autocmd VimperatorLeavePre .* emenu Tools.Sync.Sync Now
colorscheme blueyed
set errorbells visualbell
" rss-icon in statusbar, via http://code.google.com/p/vimperator-labs/issues/detail?id=237
javascript <<EOF
(function(){
var feedButton = document.getElementById("feed-button");
if ( feedButton ) {
var feedPanel = document.createElement("statusbarpanel");
feedPanel.setAttribute("id", "feed-panel-clone");
feedPanel.appendChild(feedButton);
feedPanel.firstChild.setAttribute("style", "padding: 0; max-height: 16px;");
document.getElementById("status-bar")
.insertBefore(feedPanel, document.getElementById("security-button"));
}
})();
EOF
" reddit tips (via http://www.reddit.com/r/vim/comments/crs9u/some_vimperator_tips_for_redditors/)
" open current page with reddit toolbar (allows submitting)
nmap e -js dactyl.open("http://reddit.com/s/" + encodeURIComponent(buffer.uri.spec))
" add bookmark for subreddits (":o r")
"bma -k=r http://reddit.com/r/%s/
" focus content frame (workaround for FF4?!)
" XXX: content.wrappedJSObject.frames["inner_toolbar"] ...
"autocmd PageLoad ^http://www.reddit.com/tb/.* js content.window.frames[1].window.frames[1].focus()
" command to replace all image links with the actual image (most useful with post-a-picture threads)
" based on some snippet from reddit, but adopted for Vimperator; add allFrames and maxHeight handling
command! inlineimages js (function($) {orig$=$; $.each(buffer.allFrames, function(){win=this.wrappedJSObject; $=function(sel){return orig$(sel, win.document)} ; win.document.ondragstart=function(){return false};dst=function(e){return (p=Math.pow)(p(e.clientX-(rc=e.target.getBoundingClientRect()).left,2)+p(e.clientY-rc.top,2),.5)};$("[href~=imgur]").not($(t="[href$=jpeg],[href$=gif],[href$=png],[href$=jpg]")).each(function(){this.href+='.jpg'});void($(t).not(".EGraw").attr({'class':'EGraw',target:'blank'}).each(function(){$(this).append($('<span />').toggle(function(e){$(this).html(' [-]').next().show();return false},function(e){$(this).html(' [+]').next().hide();return false}).click()).append($('<img>').attr({src:this.href,style:'display:block;max-width:500px;max-height:500px',title:'Drag to resize'}).mousedown(function(e){(t=this.wrappedJSObject).iw=t.width;t.d=dst(e);t.dr=false;t.style.maxHeight="none";e.preventDefault();}).mousemove(function(e){if((t=this.wrappedJSObject).d){t.style.maxWidth=t.style.width=((dst(e))*t.iw/t.d)+"px";t.dr=true}}).mouseout(f=function(e){(t=this.wrappedJSObject).d=false;if(t.dr)return false}).click(f))}))})})(content.wrappedJSObject.$ || $);
" search leo.org in a new tab
map <Leader>l :to http://dict.leo.org/ende?lp=ende&search=
" Open current location via Coral CDN
" String.replace is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=633830
map gp -js dactyl.open( String.replace(buffer.URL, /(\.\w{2,4})\//, "$1.nyud.net/") )
" Clear mapping for Ubiquity
map <C-k> <Nop>
" NoScript popup
map <Leader>np -ex noscript popup
silent qmark n https://www.google.de/reader/view | www.reddit.com | https://twitter.com
silent qmark r reddit.com
silent qmark t twitter.com
silent qmark g https://www.google.com/reader/view
group! editor
autocmd LocationChange .* :set editor='gvim -f -c ''set ft=html spell | call cursor(<line>, <column>)'''
autocmd LocationChange www.reddit.com,github.com,stackoverflow.com :set editor='gvim -f -c ''set ft=markdown spell | call cursor(<line>, <column>)'''
autocmd LocationChange ^https?://mail\\..* :set editor='gvim -f -c ''set ft=mail spell | call cursor(<line>, <column>)'''
autocmd LocationChange ^https?://[^/]+/phpmyadmin/ :set editor='gvim -f -c ''set ft=html | call cursor(<line>, <column>)'''
autocmd LocationChange ^https?://.*trac.*/wiki/ :set editor='gvim -f -c ''set ft=tracwiki | call cursor(<line>, <column>)'''
group default
" passthrough certain keys, see "h key-sequence" for a list
set passkeys+='https://mail\.':<Left><Right><Up><Down><Del>
" use homerow for hintkeys; see also https://code.google.com/p/dactyl/issues/detail?id=167
set hintkeys=asdfgöälkjh
" center_select plugin: https://code.google.com/p/vimperator-labs/issues/detail?id=221
nnoremap -silent zz :centerselect<CR>
"nnoremap -silent zz :centerselect "border: 5px solid orange;"<CR>
"nnoremap -silent n n:norm zz<CR>
"nnoremap -silent N N:norm zz<CR>
nnoremap zH 10h
nnoremap zL 10l
nnoremap j 5j
nnoremap k 5k
nnoremap l 5l
nnoremap h 5h
nnoremap -silent zt :topselect<CR>
nnoremap -silent zb :bottomselect<CR>
nnoremap -silent zc :removeselect<CR>
"loadplugins
" tab-options plugin:
"set tabclose=opener,previous,left,right
" Focus largest frame. This replaces the auto-focus-frame.js plugin. Props @John-Galt!
au PageLoad .* -js function area(w) w.innerWidth * w.innerHeight; buffer.allFrames(doc.defaultView.top).reduce(function (w, acc) area(w) > area(acc) ? w : acc).focus()
source! ~/.pentadactylrc.local
" vim: set ft=pentadactyl.vim:
Jump to Line
Something went wrong with that request. Please try again.