| 1 | " retlet .vimperatorrc |
|---|
| 2 | " for Vimperator hg head |
|---|
| 3 | |
|---|
| 4 | " prefs |
|---|
| 5 | " ====================================================================== |
|---|
| 6 | " ページのアクセスキーを無効化 |
|---|
| 7 | set! ui.key.generalAccessKey=0 |
|---|
| 8 | |
|---|
| 9 | " Awesomebarの補完対象にBookmarkletを含める |
|---|
| 10 | set! browser.urlbar.filter.javascript=false |
|---|
| 11 | |
|---|
| 12 | " ポップアップ許可数を拡張 cf.http://la.ma.la/blog/diary_200611171115.htm |
|---|
| 13 | set! dom.popup_maximum=9999 |
|---|
| 14 | |
|---|
| 15 | " Gmail/LDR/Fastladder/OpenFL/はてブでは新規タブをバックグラウンドで開く |
|---|
| 16 | autocmd LocationChange ^(?!https?://(mail\\.google\\.com/(mail|a)/|(reader\\.livedoor\\.com|fastladder\\.com|0\\.0\\.0\\.0\:3000)/reader/|b\\.hatena\\.ne\\.jp/(?!(entry|articles|guide)))) :set! browser.tabs.loadDivertedInBackground=false |
|---|
| 17 | autocmd LocationChange ^https?://(mail\\.google\\.com/(mail|a)/|(reader\\.livedoor\\.com|fastladder\\.com|0\\.0\\.0\\.0\:3000)/reader/|b\\.hatena\\.ne\\.jp/(?!(entry|articles|guide))) :set! browser.tabs.loadDivertedInBackground=true |
|---|
| 18 | |
|---|
| 19 | " Tumblr DashboardでAutoPagerizeのBASE_REMAIN_HEIGHTを変更 |
|---|
| 20 | autocmd VimperatorEnter .* :autocmd GMInjectedScript "www\\.tumblr\\.com/dashboard" :js liberator.eval("ap.remainHeight = 5000", plugins.gmperator.currentSandbox.window.AutoPagerize.addFilter) |
|---|
| 21 | |
|---|
| 22 | " options |
|---|
| 23 | " ====================================================================== |
|---|
| 24 | set defsearch=g |
|---|
| 25 | |
|---|
| 26 | " /,? 検索結果をハイライト |
|---|
| 27 | set hlsearch |
|---|
| 28 | |
|---|
| 29 | " ex mode でインクリメント補完 |
|---|
| 30 | set wildoptions=auto |
|---|
| 31 | |
|---|
| 32 | " :[tab]open の補完対象と順番 |
|---|
| 33 | set complete=tsl |
|---|
| 34 | |
|---|
| 35 | " ブラウザタイトルの変更 |
|---|
| 36 | set titlestring=*g* |
|---|
| 37 | |
|---|
| 38 | " GUI Options |
|---|
| 39 | set go=rb |
|---|
| 40 | |
|---|
| 41 | " タブを非表示 |
|---|
| 42 | set showtabline=0 |
|---|
| 43 | |
|---|
| 44 | " リンクのURIをコマンドラインに表示 |
|---|
| 45 | set showstatuslinks=2 |
|---|
| 46 | |
|---|
| 47 | " ページロード時にテキストボックスにフォーカスするのを防ぐ |
|---|
| 48 | set focuscontent |
|---|
| 49 | |
|---|
| 50 | " Beep設定 |
|---|
| 51 | set visualbell |
|---|
| 52 | hi Bell display: none; |
|---|
| 53 | |
|---|
| 54 | " mappings |
|---|
| 55 | " ====================================================================== |
|---|
| 56 | " undo一覧から開く |
|---|
| 57 | noremap U :undo<Space> |
|---|
| 58 | |
|---|
| 59 | " C-r でブラウザ再起動 |
|---|
| 60 | noremap <C-r> :restart<CR> |
|---|
| 61 | |
|---|
| 62 | " 上のディレクトリに移動 |
|---|
| 63 | noremap <BS> gu |
|---|
| 64 | noremap <C-BS> gU |
|---|
| 65 | |
|---|
| 66 | " j/k でのスクロール幅を1行から3行に変更 |
|---|
| 67 | noremap j 3j |
|---|
| 68 | noremap k 3k |
|---|
| 69 | noremap <C-j> 3j |
|---|
| 70 | noremap <C-k> 3k |
|---|
| 71 | |
|---|
| 72 | " J/K をC-d/u互換に |
|---|
| 73 | noremap J <C-d> |
|---|
| 74 | noremap K <C-u> |
|---|
| 75 | |
|---|
| 76 | " タブ移動 |
|---|
| 77 | noremap h <C-p> |
|---|
| 78 | noremap l <C-n> |
|---|
| 79 | |
|---|
| 80 | " タブ順序変更 |
|---|
| 81 | noremap <C-h> :tabmove! -1<CR> |
|---|
| 82 | noremap <C-l> :tabmove! +1<CR> |
|---|
| 83 | |
|---|
| 84 | " buffer |
|---|
| 85 | noremap . b |
|---|
| 86 | |
|---|
| 87 | " 未分類のブックマークに追加/削除 |
|---|
| 88 | noremap ,a A |
|---|
| 89 | |
|---|
| 90 | " ! でページのCSSをon/off |
|---|
| 91 | noremap ! :set invum<CR> |
|---|
| 92 | |
|---|
| 93 | " ページのエンコーディングを変更 |
|---|
| 94 | noremap ,es :set encoding=Shift_JIS<CR> |
|---|
| 95 | noremap ,ec :set encoding=EUC-JP<CR> |
|---|
| 96 | noremap ,eu :set encoding=UTF-8<CR> |
|---|
| 97 | noremap ,ei :set encodeing=ISO-2022-JP<CR> |
|---|
| 98 | |
|---|
| 99 | " ex modeでC-jを無効化 |
|---|
| 100 | cnoremap <C-j> <Nop> |
|---|
| 101 | |
|---|
| 102 | " plugins |
|---|
| 103 | " ====================================================================== |
|---|
| 104 | let g:plugin_loader_roots = "~/Sites/vimperator-plugins/trunk/ ~/.vimperator/load/ ~/Sites/git/littlefolk/" |
|---|
| 105 | let g:plugin_loader_plugins = "_libly,account_switcher,appendAnchor,auto_reload,copy,char-hints-mod2,direct_bookmark,feedSomeKeys_2,gmperator,hatenaStar,hint-tombloo,ldrize_cooperation,maine_coon,migemo_completion,multi_requester,no-reading,pino,pixiv_tools,proxy,sbmcommentsviewer,tombloo,twitter,walk-input,stella,opener" |
|---|
| 106 | |
|---|
| 107 | " no-reading.js |
|---|
| 108 | let g:no_reading_on_statusline = 1 |
|---|
| 109 | |
|---|
| 110 | " appendAnchor.js |
|---|
| 111 | let g:auto_append_anchor = "true" |
|---|
| 112 | |
|---|
| 113 | " sbmcommentsviewer.js |
|---|
| 114 | let g:def_sbm_format = "timestamp,id,tagsAndComment" |
|---|
| 115 | let g:def_sbms = "hdl" |
|---|
| 116 | map b :viewSBMComments<CR> |
|---|
| 117 | |
|---|
| 118 | " direct_bookmark.js |
|---|
| 119 | let g:direct_sbm_use_services_by_tag = "h" |
|---|
| 120 | let g:direct_sbm_use_services_by_post = "h" |
|---|
| 121 | let g:direct_sbm_is_normalize = "false" |
|---|
| 122 | let g:direct_sbm_is_use_migemo = "true" |
|---|
| 123 | noremap B :bentry<CR> |
|---|
| 124 | noremap a :sbm<CR> |
|---|
| 125 | noremap A :sbm<Space> |
|---|
| 126 | "noremap ,a :btags<CR> |
|---|
| 127 | autocmd VimperatorEnter .* :btags |
|---|
| 128 | |
|---|
| 129 | " hatenabookmark.js |
|---|
| 130 | noremap s :hbtab<Space> |
|---|
| 131 | noremap S :hbtab<Space> |
|---|
| 132 | js <<EOM |
|---|
| 133 | liberator.globalVariables.hBookmark_shortcuts = { |
|---|
| 134 | hintsAdd : ' ', |
|---|
| 135 | hintsComment : ' ', |
|---|
| 136 | add : ['C'], |
|---|
| 137 | comment : ['c'], |
|---|
| 138 | }; |
|---|
| 139 | if (typeof hBookmark != 'undefined') liberator.loadScript('chrome://hatenabookmark/content/vimperator/plugin/hatenabookmark.js', {__proto__: this}); |
|---|
| 140 | EOM |
|---|
| 141 | |
|---|
| 142 | " ldrize_cooperation.js |
|---|
| 143 | let g:ldrc_captureMappings = "['j','k','p','o','?']" |
|---|
| 144 | "let g:ldrc_intelligence_bind = "true" |
|---|
| 145 | "let g:ldrc_skip = "0" |
|---|
| 146 | noremap Q :toggleldrc<CR> |
|---|
| 147 | |
|---|
| 148 | " multi_requester.js |
|---|
| 149 | noremap ,t :twitter<Space> |
|---|
| 150 | noremap ,T :twitter!<Space> |
|---|
| 151 | noremap ,@ :twitter!@<CR> |
|---|
| 152 | noremap ,mt :mr<Space>twitter-search-pcod-no-jp<Space> |
|---|
| 153 | noremap ,mT :mr<Space>twitter-search-pcod-no-jp<Space>["retlet"]<CR> |
|---|
| 154 | noremap ,mf :mr<Space>favotter-new<Space> |
|---|
| 155 | noremap ,mF :mr<Space>favotter-new<Space>["retlet"]<CR> |
|---|
| 156 | |
|---|
| 157 | " copy.js |
|---|
| 158 | noremap ,c :copy<Space> |
|---|
| 159 | js <<EOM |
|---|
| 160 | liberator.globalVariables.copy_templates = [ |
|---|
| 161 | { label: 'titleAndURL', value: '%TITLE% %URL%' }, |
|---|
| 162 | { label: 'title', value: '%TITLE%' }, |
|---|
| 163 | { label: 'url', value: '%URL%' }, |
|---|
| 164 | { label: 'markdown', value: '[%TITLE%](%URL% "%TITLE%")' }, |
|---|
| 165 | { label: 'markdownsel', value: '[%SEL%](%URL% "%TITLE%")' }, |
|---|
| 166 | { label: 'htmlblockquote', value: '<blockquote cite="%URL%" title="%TITLE%">%HTMLSEL%</blockquote>' } |
|---|
| 167 | ]; |
|---|
| 168 | EOM |
|---|
| 169 | |
|---|
| 170 | " feedSomeKeys_2.js |
|---|
| 171 | autocmd LocationChange .* :fmapc |
|---|
| 172 | " Gmail |
|---|
| 173 | autocmd LocationChange ^https?://mail\\.google\\.com/(mail|a)/ :fmap! c / j k n p o u e x s r a # [ ] z ? gi gs gt gd ga gc |
|---|
| 174 | " Tumblr (use: tombloo.xpi, dashboard+tombloo.user.js, reblogcommand.user.js, playontumblr.user.js) |
|---|
| 175 | autocmd LocationChange ^http://[^\\./]*\\.tumblr\\.com/ :fmap! i,tj e,tk n,h |
|---|
| 176 | " favotter (use: twitfavcommandminibuffer.user.js) |
|---|
| 177 | autocmd LocationChange ^http://favotter\\.matope\\.com/ :fmap! f,F |
|---|
| 178 | " LDR/Fastladder/OpenFL (use: tombloo.xpi, ldr+tombloo.user.js, ldr_relative_rate.user.js) |
|---|
| 179 | autocmd LocationChange ^http://(reader\\.livedoor\\.com|fastladder\\.com|0\\.0\\.0\\.0\:3000)/reader/ :fmap! j k s a p v c z Z b,i B,b i,Tj e r < > o,vj J,<Space> K,<S-Space> q w g u T |
|---|
| 180 | " iview |
|---|
| 181 | autocmd LocationChange ^chrome://iviewfx/content/iview\\.html :fmap! j k s a z o i,tj p |
|---|
| 182 | " はてブ |
|---|
| 183 | autocmd LocationChange ^http://b\\.hatena\\.ne\\.jp/(?!(entry|articles|guide)) :fmap! j k o,oj e a,b |
|---|
| 184 | |
|---|
| 185 | " javascripts |
|---|
| 186 | " ====================================================================== |
|---|
| 187 | " 読込に失敗した画像を再読込 |
|---|
| 188 | " cf.http://d.hatena.ne.jp/caisui/20090502/1241256689 |
|---|
| 189 | "js <<EOM |
|---|
| 190 | "(function(){ |
|---|
| 191 | " var obj={ |
|---|
| 192 | " reload:function(){ |
|---|
| 193 | " obj.core.call(this,content.window); |
|---|
| 194 | " },core:function(aWindow){ |
|---|
| 195 | " var w=aWindow; |
|---|
| 196 | " for(var i=0,j=w.frames.length;i<j;++i){ |
|---|
| 197 | " arguments.callee.call(this,w.frames[i]); |
|---|
| 198 | " } |
|---|
| 199 | " var cnt=0,req,img,list=w.document.images; |
|---|
| 200 | " for(var i=0,j=list.length;i<j;++i){ |
|---|
| 201 | " img=list[i]; |
|---|
| 202 | " if(img instanceof Ci.nsIImageLoadingContent && img.currentURI){ |
|---|
| 203 | " req = img.getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST); |
|---|
| 204 | " if(req && !(req.imageStatus & req.STATUS_LOAD_COMPLETE)){ |
|---|
| 205 | " img.forceReload(); |
|---|
| 206 | " ++cnt; |
|---|
| 207 | " } |
|---|
| 208 | " } |
|---|
| 209 | " } |
|---|
| 210 | " liberator.echo("reload image:"+cnt); |
|---|
| 211 | " } |
|---|
| 212 | " } |
|---|
| 213 | " commands.addUserCommand(["reloadimage"],"reload images",obj.reload,true); |
|---|
| 214 | "})(); |
|---|
| 215 | "EOM |
|---|
| 216 | |
|---|
| 217 | " ステータスバーにfeedボタンを表示 |
|---|
| 218 | js <<EOM |
|---|
| 219 | (function(){ |
|---|
| 220 | var feedPanel = document.createElement('statusbarpanel'); |
|---|
| 221 | var feedButton = document.getElementById('feed-button'); |
|---|
| 222 | feedPanel.setAttribute('id','feed-panel-clone'); |
|---|
| 223 | feedPanel.appendChild(feedButton.cloneNode(true)); |
|---|
| 224 | feedButton.parentNode.removeChild(feedButton); |
|---|
| 225 | document.getElementById('status-bar').insertBefore(feedPanel,document.getElementById('security-button')); |
|---|
| 226 | })(); |
|---|
| 227 | EOM |
|---|
| 228 | |
|---|
| 229 | " yourfilehost cookie削除 |
|---|
| 230 | " cf.http://anond.hatelabo.jp/20100108213648 |
|---|
| 231 | js <<EOM |
|---|
| 232 | commands.addUserCommand( |
|---|
| 233 | ['removeCookieOfYourfile'], |
|---|
| 234 | 'removeCookieOfYourfile', |
|---|
| 235 | function() { |
|---|
| 236 | liberator.execute('cookiemanager remove yourfilehostdatabase.com/'); |
|---|
| 237 | liberator.execute('cookiemanager remove yourfilehost.com/'); |
|---|
| 238 | liberator.execute('cookiemanager remove yourlifehost.jp/'); |
|---|
| 239 | } |
|---|
| 240 | ); |
|---|
| 241 | EOM |
|---|
| 242 | |
|---|
| 243 | " LocalMappings |
|---|
| 244 | " cf.http://vimperator.g.hatena.ne.jp/nokturnalmortum/20100128/1264675483 |
|---|
| 245 | js <<EOM |
|---|
| 246 | function addLocalMappings(buffer, maps) { |
|---|
| 247 | maps.forEach( |
|---|
| 248 | function (map) { |
|---|
| 249 | let [cmd, action, extra] = map; |
|---|
| 250 | let actionFunc = action; |
|---|
| 251 | extra || (extra = {}); |
|---|
| 252 | |
|---|
| 253 | if (typeof action == "string") { |
|---|
| 254 | if (action.charAt(0) == ':') |
|---|
| 255 | actionFunc = extra.open ? function () commandline.open("", action, modes.EX) |
|---|
| 256 | : function () liberator.execute(action); |
|---|
| 257 | else |
|---|
| 258 | actionFunc = function () events.feedkeys(action, extra.noremap, true); |
|---|
| 259 | } |
|---|
| 260 | extra.matchingUrls = buffer; |
|---|
| 261 | mappings.addUserMap( |
|---|
| 262 | [modes.NORMAL], |
|---|
| 263 | [cmd], |
|---|
| 264 | "Local mapping for " + buffer, |
|---|
| 265 | actionFunc, |
|---|
| 266 | extra |
|---|
| 267 | ); |
|---|
| 268 | } |
|---|
| 269 | ); |
|---|
| 270 | } |
|---|
| 271 | |
|---|
| 272 | addLocalMappings( |
|---|
| 273 | /^(http:\/\/(es|www).nicovideo.jp\/watch|http:\/\/(jp|www)\.youtube\.com\/watch)/, |
|---|
| 274 | [ |
|---|
| 275 | ['p', ':stplay', ], |
|---|
| 276 | ['m', ':stmute', ], |
|---|
| 277 | ['c', ':stcomment', ], |
|---|
| 278 | ['zz', ':stlarge', ], |
|---|
| 279 | ['r', ':strepeat', ], |
|---|
| 280 | ['+', ':stvolume! 10', ], |
|---|
| 281 | ['-', ':stvolume! -10', ], |
|---|
| 282 | ['C-h', ':stseek! -10', ], |
|---|
| 283 | ['C-l', ':stseek! 10', ], |
|---|
| 284 | ] |
|---|
| 285 | ); |
|---|
| 286 | EOM |
|---|
| 287 | |
|---|
| 288 | " qmarks |
|---|
| 289 | " ====================================================================== |
|---|
| 290 | qmark g https://mail.google.com/ |
|---|
| 291 | qmark c https://www.google.com/calendar/ |
|---|
| 292 | qmark p pp |
|---|
| 293 | qmark l al |
|---|
| 294 | qmark f af |
|---|
| 295 | qmark t at |
|---|
| 296 | qmark r recss |
|---|
| 297 | |
|---|
| 298 | " highlight/style |
|---|
| 299 | " ====================================================================== |
|---|
| 300 | colorscheme vimplight |
|---|
| 301 | |
|---|
| 302 | " [tab]open等で長いタイトルがURIに被るらないように |
|---|
| 303 | hi CompResult widht: 45%; overflow: hidden; max-width; 60%; |
|---|
| 304 | |
|---|
| 305 | " ステータスバーのアイコンの間隔を揃える |
|---|
| 306 | style -name statusbar chrome://* <<EOM |
|---|
| 307 | #status-bar statusbarpanel { padding: 0 1px !important; } |
|---|
| 308 | statusbarpanel > * { margin: 0 !important; padding: 0 !important; } |
|---|
| 309 | EOM |
|---|
| 310 | |
|---|
| 311 | " ex mode時IMEをOFF |
|---|
| 312 | style -name commandline-ime chrome://* #liberator-commandline-command input { ime-mode: inactive; } |
|---|
| 313 | |
|---|
| 314 | " vim: set ft=vimperator: |
|---|