root/dotfiles/vimperator/otsune-vimperatorrc

Revision 38301, 10.3 kB (checked in by otsune, 21 months ago)

misc update

Line 
1" otsune .vimperatorrc
2"2.1 (created: 2009/05/21 13:13:06)
3
4echo "loading..."
5autocmd VimperatorEnter .* pluginmanager update
6
7" Mappings
8" minimum css
9noremap ! :set usermode<CR>
10
11" set mark-a, jump mark-a
12noremap _ ma
13noremap } `a
14
15"
16noremap j 5j
17noremap k 5k
18noremap J <C-d>
19noremap K <C-u>
20
21" select next/previous tab
22"noremap <Right> gt
23"noremap <Left> gT
24noremap <C-l> gt
25noremap <C-h> gT
26noremap <C-w>l gt
27noremap <C-w>h gT
28
29" move current tab left/right
30map <S-Right> :tablast<CR>
31map <S-Left> :tabfirst<CR>
32map <C-L> :tabmove! +1<CR>
33map <C-H> :tabmove! -1<CR>
34
35" ex mode
36cmap <C-d> <Tab>
37"cmap <Down> <Tab>
38"cmap <Up> <S-Tab>
39cmap <C-n> <Tab>
40cmap <C-p> <S-Tab>
41
42" http://memo.officebrook.net/20090803.html#p01
43vmap <silent> <C-g> y<Esc><Esc>P
44
45"
46let mapleader=','
47map <A-b> :set guioptions+=B<CR>
48""map <Leader>b :set guioptions+=B<CR>
49map <A-B> :set guioptions-=B<CR>
50""map <Leader>B :set guioptions-=B<CR>
51"noremap <Leader>t :mb tumblr.reblog<CR>
52noremap <Leader>b :bentry<CR>
53"noremap <Leader>p :pukka<CR>
54noremap <Leader>t :tombloo Quote<CR>
55"noremap <Leader>m :tabmove 1<CR>
56"noremap <Leader>l :toggleldrizecooperation<CR>
57noremap <Leader>l :tombloo Link<CR>
58noremap <Leader>g :mb location | web-gyotaku | open <CR>
59noremap <Leader>a :mb location | web-archive | open <CR>
60noremap <Leader>s :mb pinned-or-current-link | share-twitter-on-tumblr | clear-pin <CR>
61noremap <Leader>r :mb reblog<CR>
62" http://vimperator.g.hatena.ne.jp/snaka72/20100704/1278205709
63noremap <Leader>m :js Readability.enableREADABILITY({target: {id: 'readability-statusbar-icon'}})<CR>
64" http://vimperator.g.hatena.ne.jp/saitamanodoruji/20090630/1246330024
65"map <silent> <Leader>mT :js content.window.open('http://www.google.com/translate_t?langpair=auto|en&text=' + window.content.window.getSelection().toString())<CR>
66
67
68" http://vimperator.g.hatena.ne.jp/saitamanodoruji/20090613/1244854256
69"map <Leader>z :js var u=liberator.modules.buffer.URL.replace(/http:\/\/(.*)\.2ch\.net\/test\/read\.cgi\/(.*)\/(\d{4})(\d{1})(\d{5})\/\d{0,4}[n-]{0,2}/, "http://mimizun.com/search/perl/dattohtml.pl?http://mimizun.com/log/2ch/$2/$1.2ch.net/$2/kako/$3/$3$4/$3$4$5.dat");liberator.open(u)<CR>
70
71" Unhidden and hidden the menubar and the toolbar
72"map <A-Up> :set guioptions+=mT<CR>
73"map <A-Down> :set guioptions-=mT<CR>
74
75"javascript <<EOM
76"  toggle_element = function (name){
77"    document.getElementById(name).collapsed ^= 1;
78"  }
79"EOM
80
81" ;A
82javascript <<EOM
83hints.addMode( 'A', 'copy URL and description',
84  function (element) util.copyToClipboard('<a href="' + element.href + '">' + element.textContent + '</a>', true),
85  function () '//a[@href]'
86);
87EOM
88
89" Options
90"highlight Bell display:none
91set guioptions=rb
92"set titlestring=Vimperator
93"set verbose=9
94"set history=1000
95"set complete=slS
96"set complete=slr
97"set wildoptions=auto
98"set suggestengines=google
99"set newtab=all
100set focuscontent
101"set hintstyle+=font-size:15px;
102"]]
103"set nextpattern+=次(の)?ページ,→\b,下一頁,Следующая,다음
104"[[
105"set previouspattern+=prev, 前(の)?ページ,\b←
106"
107set editor=/Applications/MacVim/mvim\ -f
108
109"js <<EOM
110"
111"liberator.globalVariables.plugin_loader_roots = "/Users/otsune/proj/coderepos/lang/javascript/vimperator-plugins/";
112
113"liberator.globalVariables.plugin_loader_plugins = [
114"  'appendAnchor.js',
115"  'copy.js',
116"  'direct_bookmark.js',
117"  'googlesuggest.js',
118"  'highlight.js',
119"  'inspector.js',
120"  'ldrize_cooperation.js',
121"  'mouseinspect.js',
122"  'multi_requester.js',
123"  'nicovideo_comment.js',
124"  'pathtraq.js',
125"  'pluginManager.js',
126"  'proxy.js',
127"  'pukka.js',
128"  'tombloo.js',
129"  'xpathBlink.js',
130"];
131"EOM
132
133" nextlink.js
134let g:nextlink_followlink = "true"
135
136" direct_bookmark.js
137"let g:direct_sbm_use_services_by_tag = "hd"
138"let g:direct_sbm_use_services_by_post = "hd"
139let g:direct_sbm_is_normalize = "true"
140
141" pukka plugin variable
142let g:pukka_normalizelink = "true"
143
144" ime_control.js
145"let g:ex_ime_mode = "disabled"
146"let g:ex_ime_mode = "inactive"
147"let g:textarea_ime_mode = "inactive"
148
149" ldr_cooperation.js
150let g:ldrc_captureMappings = "['t', 'T', 'h', 'l', 'j', 'k', 'p', 'o', '?']"
151"let g:ldrc_hints = "true"
152let g:ldrc_intelligence_bind = "true"
153
154" feedSomekey_2
155"autocmd LocationChange .* :fmapc
156
157" autocmd LocationChange 'ogame\.jp' :fmap <Left> <Right> <Up> <Down>
158"autocmd LocationChange 'mail\.google\.com/mail' :fmap -depth 4 c / j k n p o u e x s r a # [ ] z ? gi gs gt gd ga gc
159"autocmd LocationChange .* :js modes.passAllKeys = /^https?:\/\/mail\.google\.com/.test(buffer.URL)
160"autocmd LocationChange .* :js modes.passAllKeys = /^https?:\/\/fastladder\.com/.test(buffer.URL)
161
162" feedSomeKeys_3
163" http://vimperator.g.hatena.ne.jp/nokturnalmortum/20100302/1267531921
164command! -nargs=+ lazy autocmd VimperatorEnter .* <args>
165lazy fmaps -u='mail\.google\.com/mail' c / j k n p o u e x s r a # [ ] ? gi gs gt gd ga gc
166lazy 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
167lazy fmaps -u='www\.google\.co\.jp/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
168lazy fmaps -u='(fastladder|livedoor)\.com/reader' j k s a p o v c i,p <Space> <S-Space> z b < > q w e,g
169lazy 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>
170lazy fmaps -u='http://code.google.com/p/vimperator-labs/issues/list' o j k
171lazy fmaps -u='http://code.google.com/p/vimperator-labs/issues/detail' u
172
173
174" URLの正規表現を「"」でなくて、「'」で括るのが密かなポイントです。
175" (「"」の場合、エスケープを \\ のように二重にしなくてはいけなくなります。)
176" copy.js
177"javascript <<EOM
178"liberator.globalVariables.copy_templates = [
179"   { label: 'H::D(Image2)', value: 'Hatena::ImageMax 650px',
180"  custom: function() { let [, width, height] = buffer.title.match(/\(PNG\s\S+, \s([0-9]+)x([0-9]+)\spx\)/); const MAX_W = 650; let maxWidth = width > MAX_W ? ":w" + MAX_W : ""; return '[' + buffer.URL + ':image' + maxWidth + ']'; }
181"   },
182"   { label: 'titleAndURL',    value: '%TITLE% %URL%' },
183"   { label: 'title',          value: '%TITLE%' },
184"   { label: 'hatena',         value: '[%URL%:title=%TITLE%]' },
185"   { label: 'hatenacite',     value: '>%URL%:title=%TITLE%>\n%SEL%\n<<' },
186"   { label: 'markdown',       value: '[%SEL%](%URL% "%TITLE%")' },
187"   { label: 'htmlahref', value: '<a href="%URL%">%TITLE% - %HTMLSEL%</a>' },
188"   { label: 'htmlblockquote', value: '<blockquote cite="%URL%" title="%TITLE%">%HTMLSEL%</blockquote>' },
189"   { label: 'amazon',   value: 'copy asamashi code from Amazon', custom: function(){return 'http://amazon.jp/o/ASIN/'+ content.document.getElementById('ASIN').value + '/jq-22';} },
190"   { label: 'tinyurl',        value: 'Get Tiny URL',
191"    custom: function(){ return util.httpGet('http://tinyurl.com/api-create.php?url=' + encodeURIComponent(buffer.URL)).responseText; }
192"   },
193"];
194"EOM
195js liberator.globalVariables.copy_use_wedata = true;
196
197" x-hint.js
198nnoremap -urls='^http://www\.tumblr\.com/(dashboard|tumblelog|show)' f :xh t //*[@class="quote_source"]//a[not(@class="tumblr_blog")]|//*[@class="caption"]//a[not(@class="tumblr_blog")]<CR>
199
200" http://subtech.g.hatena.ne.jp/secondlife/20100126/1264487474
201noremap yy :javascript util.copyToClipboard(buffer.URL);<CR>
202
203" Add Mapping `C-c' copy or stop loading
204javascript <<EOF
205mappings.addUserMap([modes.NORMAL,modes.VISUAL],['<C-c>'], 'Copy selected text or stop loading',
206        function(){
207                var sel = window.content.window.getSelection().toString();
208                if (sel){
209                        util.copyToClipboard(sel,true);
210                } else {
211                        BrowserStop();
212                        echo('Stopped loading !');
213                }
214        }
215);
216EOF
217
218" Show feed-button to statusbar
219javascript <<EOM
220(function () {
221var feedPanel = document.createElement('statusbarpanel');
222var feedButton = document.getElementById('feed-button');
223    feedPanel.setAttribute('id','feed-panel-clone');
224    feedPanel.appendChild(feedButton.cloneNode(true));
225    feedButton.parentNode.removeChild(feedButton);
226    document.getElementById('status-bar')
227        .insertBefore(feedPanel,document.getElementById('security-button'));
228})();
229EOM
230
231" http://vimperator.g.hatena.ne.jp/blue_ring/20090403/1238762521
232" inspect mode hint
233js <<EOM
234hints.addMode('i', 'inspectThis', function(elem){ inspectDOMNode(elem) }, function() '//*');
235commands.addUserCommand(['setInspectionXPath', 'six'], 'Set a XPath in the Hints Mode of Inspection', function(args){
236  hints.addMode('i', 'inspectThis', function(elem){ inspectDOMNode(elem) }, function() args.string);
237}, {}, true);
238EOM
239
240" hatena bookmark xul
241javascript if (typeof hBookmark != 'undefined') liberator.loadScript('chrome://hatenabookmark/content/vimperator/plugin/hatenabookmark.js', {__proto__: this});
242
243" disable accesskey
244"set! ui.key.generalAccessKey=-1
245set! ui.key.contentAccess=0
246" open bookmarks in background
247set! browser.tabs.loadBookmarksInBackground=true
248
249" http://vimperator.g.hatena.ne.jp/teramako/20090915/1253017889
250"js modules.__defineGetter__("doc", function() content.document.wrappedJSObject)
251"js modules.__defineGetter__("win", function() content.window.wrappedJSObject)
252
253" http://vimperator.g.hatena.ne.jp/nokturnalmortum/20100308/1267811912
254js <<EOM
255let (c = modules.userContext) {
256  c.__defineGetter__("doc", function() content.document.wrappedJSObject);
257  c.__defineGetter__("win", function() content.window.wrappedJSObject);
258  c.echo = liberator.echo;
259  c.log = liberator.log;
260}
261EOM
262
263" http://vimperator.g.hatena.ne.jp/teramako/20091124/1259075950
264" :command gcalc -nargs=* echo JSON.parse(util.httpGet("http://suggestqueries.google.com/complete/search?client=firefox&hl=ja&q="+encodeURIComponent("<args>")).responseText)[1].filter(function(r) r.indexOf("=") == 0)[0].replace("= ", "")
265
266" http://vimperator.g.hatena.ne.jp/teramako/20090311/1236776437
267:style -name commandline-ime chrome://* #liberator-commandline-command input {ime-mode: inactive;}
268
269" http://anond.hatelabo.jp/20100108213648
270javascript <<EOM
271commands.addUserCommand(
272    ['removeCookieOfYourfile'],
273    'removeCookieOfYourfile',
274    function() {
275    liberator.execute('cookiemanager remove yourfilehostdatabase.com/');
276    liberator.execute('cookiemanager remove yourfilehost.com/');
277    liberator.execute('cookiemanager remove yourlifehost.jp/');
278    }
279    );
280EOM
281
282" Abbreviations
283
284source! /Users/otsune/.vimperatorrc.local
285
286" colorscheme sweets
287echo "done"
288" vim: ft=vimperator sw=2 sts=2
Note: See TracBrowser for help on using the browser.