-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimperatorrc
96 lines (71 loc) · 6.96 KB
/
vimperatorrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
" 2.3.1 (created: 2010/04/07 18:25:13)
" <leader> = \
" a good source http://github.com/mashiro/dot-files/blob/master/.vimperatorrc
" use y to copy the current page's url
" "readability
noremap <silent> <leader>read :open javascript:(function(){readConvertLinksToFootnotes=false;readStyle='style-novel';readSize='size-medium';readMargin='margin-wide';_readability_script=document.createElement('script');_readability_script.type='text/javascript';_readability_script.src='http://lab.arc90.com/experiments/readability/js/readability.js?x='+(Math.random());document.documentElement.appendChild(_readability_script);_readability_css=document.createElement('link');_readability_css.rel='stylesheet';_readability_css.href='http://lab.arc90.com/experiments/readability/css/readability.css';_readability_css.type='text/css';_readability_css.media='all';document.documentElement.appendChild(_readability_css);_readability_print_css=document.createElement('link');_readability_print_css.rel='stylesheet';_readability_print_css.href='http://lab.arc90.com/experiments/readability/css/readability-print.css';_readability_print_css.media='print';_readability_print_css.type='text/css';document.getElementsByTagName('head')[0].appendChild(_readability_print_css);})();<CR>
" Papers
noremap <silent> <leader>paper :open javascript:if(navigator.userAgent.indexOf('Safari')%20%3E=%200){s=getSelection();}else{s=document.selection?document.selection.createRange().text:document.getSelection();}document.location.href='papers://url/'+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&selectedText='+encodeURIComponent(s);<CR>
" "Instapaper
noremap <silent> <leader>insta :open javascript:function%20iprl5(){var%20d=document,z=d.createElement('scr'+'ipt'),b=d.body;try{if(!b)throw(0);d.title='(Saving...)%20'+d.title;z.setAttribute('src','http://www.instapaper.com/j/i4uJRZ3AvsE6?u='+encodeURIComponent(d.location.href)+'&t='+(new%20Date().getTime()));b.appendChild(z);}catch(e){alert('Please%20wait%20until%20the%20page%20has%20loaded.');}}iprl5();void(0);<CR>
"read it later
noremap <silent> <leader>ril :open javascript:(function(){ISRIL_H='f0a0';ISRIL_SCRIPT=document.createElement('SCRIPT');ISRIL_SCRIPT.type='text/javascript';ISRIL_SCRIPT.src='http://readitlaterlist.com/b/r.js';document.getElementsByTagName('head')[0].appendChild(ISRIL_SCRIPT)})();<CR>
" "Gmail this
noremap <silent> <leader>gm :open javascript:popw='';Q='';x=document;y=window;if(x.selection)%20{Q=x.selection.createRange().text;}%20else%20if%20(y.getSelection)%20{Q=y.getSelection();}%20else%20if%20(x.getSelection)%20{Q=x.getSelection();}popw%20=%20y.open('https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=&su='%20+%20escape(document.title)%20+%20'&body='%20+%20escape(Q)%20+%20escape('\n')%20+%20escape(location.href)%20+%20'&zx=RANDOMCRAP&shva=1&disablechatbrowsercheck=1&ui=1','gmailForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if%20(!document.all)%20T%20=%20setTimeout('popw.focus()',50);void(0);<CR>
" show photos"
noremap <silent> <leader>foto :open javascript:%20var%20x=%20$(".content").find("a").each(function(){var%20href=$(this).attr("href");if((!$(this).hasClass("drowsapMorphed"))%20&&%20($(this).next(".drowsapMorphed").length==0)%20&&%20href%20&&%20(href.indexOf('imgur')>=0%20||%20href.indexOf('jpeg')>=0%20||%20href.indexOf('jpg')>=0%20%20||%20href.indexOf('png')>=0)){var%20ext%20=(href.indexOf('imgur')>=0%20&&%20href.indexOf('jpg')<0%20&&%20href.indexOf('png')<0)%20?%20'.jpg'%20:'';%20var%20img%20=%20$("<a%20class='drowsapMorphed'%20href='"+href+"'%20target='blank'%20style='display:block'><img%20style='display:block;max-width:780px;'%20src='"+href+%20ext+"'%20/></a>");$(this).after(img);}});<CR>
" "Delicious bookmark
noremap <silent> <leader>del :open javascript:(function(){f='http://www.delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&v=5&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv5','location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=550'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})();<CR>
" Make the RSS feed icon show in the vimperator status bar
javascript <<EOF
(function(){
var feedPanel = document.createElement("statusbarpanel");
feedPanel.setAttribute("id", "feed-panel-clone");
feedPanel.appendChild(document.getElementById("feed-button"));
feedPanel.firstChild.setAttribute("style", "padding: 0; max-height: 16px;");
document.getElementById("status-bar").insertBefore(feedPanel, document.getElementById("security-button"));
})();
EOF
" Movement
noremap j 3j
noremap k 3k
" Quickmarks (go* in current tab, gn* in new tab)
:qmark b http://elesson.com.cn/forum/, http://bbs.trends.com.cn/forumdisplay.php?fid=21&page=1, http://bbs.hellof1.com/f1
:qmark u http://emacsformacosx.com/, http://wiki.kncn.net/
:qmark d http://www.dealsea.com, http://www.dealnews.com, http://www.dealcatcher.com
:qmark r https://www.google.com/reader/view/
:qmark R http://www.reddit.com
:qmark m https://mail.google.com
"" autocmd LocationChange .* :js modes.passAllKeys = /mail\.google\.com|www\.google\.com\/reader\/view/.test(buffer.URL)
""command -nargs=* Google open google
" 齐全的next和previous……需要注意我在 \bnext\b 前加了一个 ^\bnext\b ,因为比如在SciAm网站,经常match到右上角的“What's next”栏目,而不是文章下方的next链接。先match前缀可以解决这个问题。又,suivant和précédent是法语
" "set nextpattern=\s*下一页|下一张|下一篇|下一頁|下页|后页\s*,^\bnext\b,\bnext\b,\bsuivant \b,^>$,^(>>|››|»)$,^(>|»),(>|»)$,\bmore\b
" "set previouspattern=\s*上一页|上一张|上一篇|上一頁|上页|前页\s*,^\bprev|previous\b, \bprev|previous\b,\bprécédent\b,^<$,^(<<|‹‹|«)$,^(<|«),(<|«)$
" http://pchu.blogbus.com/logs/36870556.html
" "Plugins
command! -nargs=+ lazy autocmd VimperatorEnter .* <args>
lazy fmaps -u='mail\.google\.com/mail' c / j k n p o u e x s r a # [ ] ? gi gs gt gd ga gc
lazy fmaps -u='mail\.google\.com/mail/.*/[0-9a-f]+$' c / j,n k,p n,j p,k o u e x s r a # [ ] ? gi gs gt gd ga gc
lazy fmaps -u='www\.google\.com/reader' -events=vkeypress j k n p m s v A r S N P X O gh ga gs gt gu u / ? J K
" " lazy fmaps -u='https?://www\.rememberthemilk\.com/home/' j k m i c t ? d F,f G,g S,s L,l Y,y H,h M"",m <Del> <C-S-Left> <C-S-Right>
" "lazy fmaps -u='http://code.google.com/p/vimperator-labs/issues/list' o j k
" "lazy fmaps -u='http://code.google.com/p/vimperator-labs/issues/detail' u
" Toggle Autopagerize {{{2
javascript <<EOM
let (evaluateXPath = util.evaluateXPath || buffer.evaluateXPath) {
commands.addUserCommand(
['autopagerize'],
'Toggle AutoPagerize',
function (args) {
buffer.followLink(
evaluateXPath('id("autopagerize_help")/div/a[@class="autopagerize_link"]').snapshotItem(0)
);
},
{},
true
);
}
EOM
" toggle autopagerize
noremap <silent> <Leader>a :autopagerize<CR>
" vim: set ft=vimperator: