Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
374 lines (321 sloc) 13.5 KB
" ===========================
" Scripts
" ===========================
" copy.js
javascript <<EOM
liberator.globalVariables.copy_templates = [
{label: 'anchor', value: '<a href=\"%URL\">%TITLE%</a>'},
{label: 'htmlblockquote', value: '<blockquote cite=\"%URL%\" title=\"%TITLE%\">%HTMLSEL%</blockquote>'},
{label: 'selanchor', value: '<a href=\"%URL%\" title=\"%TITLE%\">%SEL%</a>'},
{label: 'title', value: '%TITLE%'},
{label: 'titleAndUrl', value: '%TITLE%\n%URL%'},
{label: 'markdown', value: 'markdown test', map: ',m2',
custom: function() {
var d = content.document;
return '['+d.title.replace(/([\[\]])/g,'\\$1')+']'+'('+d.location.href+')';
}
},
];
EOM
" https://github.com/hatena/hatena-bookmark-xul/wiki/Vimperator-%E3%81%A7%E3%81%AF%E3%81%A6%E3%81%AA%E3%83%96%E3%83%83%E3%82%AF%E3%83%9E%E3%83%BC%E3%82%AF%E6%8B%A1%E5%BC%B5%E3%82%92%E4%BD%BF%E3%81%86
javascript <<EOM
// キーボードショートカットの指定
// 空(null)を指定すれば hints や nnoremap を上書きしなくなる
// (注: 現バージョンではデフォルト値で上書きされてます。将来修正予定です)
liberator.globalVariables.hBookmark_shortcuts = {
hintsAdd : 'B',
hintsComment : 'C',
add : ['B'],
comment : ['C'],
};
EOM
" https://github.com/vimpr/vimperator-plugins/blob/master/stella.js
javascript <<EOM
liberator.globalVariables.stella_nico_use_comment=true
function addLocalMappings(buffer, maps) {
maps.forEach(
function (map) {
let [cmd, action, extra] = map;
let actionFunc = action;
extra || (extra = {});
if (typeof action == "string") {
if (action.charAt(0) == ':')
actionFunc = extra.open ? function () commandline.open("", action, modes.EX)
: function () liberator.execute(action);
else
actionFunc = function () events.feedkeys(action, extra.noremap, true);
}
extra.matchingUrls = buffer;
mappings.addUserMap(
[modes.NORMAL],
[cmd],
"Local mapping for " + buffer,
actionFunc,
extra
);
}
);
}
addLocalMappings(
/^(http:\/\/(es|www).nicovideo.jp\/(watch|playlist\/mylist)|https:\/\/(jp|www)\.youtube\.com\/watch|http:\/\/(www\.)?vimeo\.com\/(channels\/(hd)?#)?\d+)/,
[
['<C-g>', ':pageinfo S', ],
['p', ':stplay', ],
['m', ':stmute', ],
['c', ':stcomment', ],
['zz', ':stlarge', ],
['r', ':strepeat', ],
['+', ':stvolume! 10', ],
['-', ':stvolume! -10', ],
['<Left>', ':stseek! -10', ],
['<Right>', ':stseek! 10', ],
['s', ':stseek ', {open: true}],
['S', ':stseek! ', {open: true}],
['v', ':stvolume ', {open: true}],
['V', ':stvolume! ', {open: true}],
['o', ':strelations ', {open: true}],
['O', ':strelations! ', {open: true}],
]
);
EOM
" ===========================
" Plugins
" ===========================
" 設定しないと$PATHが通らず vimppm が使えない環境があった
set shell=/bin/zsh
" TODO
" cd ~/.vimperator
" mkdir vimppm && cd vimppm
" git clone git://github.com/cd01/vimppm .
source ~/.vimperator/vimppm/plugin/vimppm.js
vimppm 'petitviolet/vimp-plugins'
source ~/.vimperator/vimppm/vimp-plugins/slideshare.js
source ~/.vimperator/vimppm/vimp-plugins/speakerdeck.js
" Vimpr list (only js file)
vimppm '_libly.js'
vimppm '_smooziee.js'
vimppm 'copy.js'
vimppm 'caret-hint.js'
vimppm 'amazon_simple_uri.js'
vimppm 'feedSomeKeys_3.js'
vimppm 'stella.js'
vimppm 'migemo-find.js'
" vimppm 'sbmcommentsviewer.js'
" ===========================
" Variables
" ===========================
" _smooziee.js
let g:smooziee_scroll_amount="90"
"============================
" about:config
"============================
" 新しいタブはバックグランドで開く
set! browser.tabs.loadDivertedInBackground=true
"============================
" stylesheet
"============================
" firefoxの句読点が読みにくいので上書き
style * * {word-break: normal !important;}
" ===========================
" Settings
" ===========================
" ブラウザタイトルを変更
set titlestring=Firefox
" 検索語を強調表示
set hlsearch
" ビープ音を無効化
set visualbell
highlight Bell display:none;
" 常にタブ表示
set showtabline=2
" アドレス補完
" オートコンプリート関係
" s 検索エンジンのみ
" f ローカルファイル
" b ブックマーク
" h 履歴
" l ロケーションバー(ブックマーク、履歴)
" S 検索サジェスト
set complete=lbsS
"set complete=sSltf
"set complete=lb
" エラー出力レベル
set verbose=9
" GUI options
set gui=none
set gui+=menu,tabs,navigation,addons
" helpなどを新しいタブで開く
set newtab=all
" No focus
set focuscontent
set hintchars=hjklasdfgyuiowertnm
" IME off
style -name commandline-ime chrome://* #liberator-commandline-command input { ime-mode: inactive; }
" タブ追加アイコンを非表示に
style chrome://* .tabs-newtab-button {display: none;}
" Hatena::Bookmark
javascript if (typeof hBookmark != 'undefined') liberator.loadScript('chrome://hatenabookmark/content/vimperator/plugin/hatenabookmark.js', {__proto__: this});
" feedSomeKeys_3.js
:command! -nargs=+ lazy autocmd VimperatorEnter .* <args>
:lazy fmap -modes=i -events=keydown,keypress <C-p> <Up>
:lazy fmap -modes=i -events=keydown,keypress <C-n> <Down>
:lazy fmaps -u='b\.hatena\.ne\.jp/' j k o e b
:lazy fmaps -u='calendar\.google\.com' -e 'vkeydown' j k t a w m x c e / + q s ?
:lazy fmaps -u='mail\.google\.com/mail' c / j k n p o u e x s r a z # [ ] ? gi gs gt gd ga gc <S-i> <S-u>
:lazy fmaps -u='^http://twitter.com/' <Space> . j k ?
:lazy fmaps -u='^http://twitter.com/' -events=vkeydown f r t n m gh gr gp gf gm
" feedSomeKeys_3 ではうまく設定できなかったので、ignorekeysで無効化
ignorekeys add www\\.facebook\\.com -except J,K,H,L,f,:,,
" qmark go + ○ でアクセス gn*, go*
qmark b http://b.hatena.ne.jp/
qmark c https://calendar.google.com/
qmark m https://mail.google.com/mail/
set nextpattern=^次(へ|の|ペ)?,^続き,NEXT,(next|more),^(>>*|»)
set previouspattern=^前(へ|の|ペ)?,^戻る,BACK,(prev|previous),^(<<*|«)
"---------------------------------------------------------------------------}}}
" Bookmarks (for search) {{{
"------------------------------------------------------------------------------
" Search Engine
bmark -title="Google" -keyword=g http://www.google.com/search?q=%s
" ALC
bmark -title="ALC" -keyword=a http://eow.alc.co.jp/%s/UTF-8/
set defsearch=g
bmark -title="Google - I'm feeling lucky!" -tags=keyword -keyword=l https://www.google.co.jp/search?q=%s&btnI=I
bmark -title="Hatena tag" -tags=keyword -keyword=ht http://b.hatena.ne.jp/search/tag?q=%s
bmark -title="Wikipedia" -tags=keyword -keyword=w https://ja.wikipedia.org/wiki/%s
bmark -title="niconico" -tags=keyword -keyword=n http://www.nicovideo.jp/search/%s
bmark -title="niconico dictionary" -tags=keyword -keyword=nd http://dic.nicovideo.jp/s/al/a/%s
bmark -title="Google image" -tags=keyword -keyword=p http://www.google.com/search?site=imghp&tbm=isch&q=%s
bmark -title="Google Map" -tags=keyword -keyword=m https://www.google.com/maps/place/%s
bmark -title="Google Trends" -tags=keyword -keyword=tr https://www.google.co.jp/trends/explore#q=%s
bmark -title="IP address" -tags=keyword -keyword=ip http://www.ip-adress.com/whois/%s
bmark -title="flickr" -tags=keyword -keyword=f https://www.flickr.com/search/?text=%s&safe_search=3
bmark -title="Youtube" -tags=keyword -keyword=y http://www.youtube.com/results?search_query=%s&sm=3
bmark -title="Yahoo real time search" -tags=keyword -keyword=rt http://realtime.search.yahoo.co.jp/search?p=%s&ei=UTF-8
bmark -title="twitter" -tags=keyword -keyword=tw https://twitter.com/search?f=tweets&vertical=default&src=typd&q=%s
bmark -title="Google Scholar" -tags=keyword -keyword=sc http://scholar.google.co.jp/scholar?as_vis=1&q=%s&hl=ja&as_sdt=1
bmark -title="Qiita" -tags=keyword -keyword=q http://qiita.com/search?q=%s
bmark -title="Github - repo" -tags=keyword -keyword=gi https://github.com/search?q=%s
bmark -title="Github - user" -tags=keyword -keyword=gu https://github.com/search?q=%s&type=Users
bmark -title="Github - code" -tags=keyword -keyword=gc https://github.com/search?q=%s&type=Code
bmark -title="Github - code filename" -tags=keyword -keyword=gf https://github.com/search?q=filename:%s&type=Code
bmark -title="Gist" -tags=keyword -keyword=gs https://gist.github.com/search?utf8=✓&q=%s
bmark -title="translate ja <-> en" -tags=keyword -keyword=t http://ejje.weblio.jp/content/%s
bmark -title="Gmail" -tags=keyword -keyword=gm https://mail.google.com/mail/u/0/#search/%s
bmark -title="Hacker News" -tags=keyword -keyword=hn https://hn.algolia.com/?q=%s
bmark -title="Pinterest" -tags=keyword -keyword=pin https://www.pinterest.com/search/pins/?q=%s
bmark -title="Stackoverflow" -tags=keyword -keyword=stack https://stackoverflow.com/search?q=%s
" ===========================
" key maps
" ===========================
map ,r :source<Space>~/.vimperatorrc<CR>
" .Ctrl+r で再起動
map ,<C-r> :restart<CR>
" Bookmarks
map ,b :bmarks!<Space>
" History
map ,h :history!<Space>
" sでぐぐる
nnoremap s :tabopen<Space>google<Space>
inoremap { {}<LEFT>
inoremap [ []<LEFT>
inoremap ( ()<LEFT>
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
cnoremap <C-f> <Right>
cnoremap <C-b> <Left>
cnoremap <C-y> <C-v>
" 補完リストの選択を<C-n>や<C-p>で
cmap <C-n> <TAB>
cmap <C-p> <S-TAB>
" _smooziee を使いつつ dとuでスクロール
noremap <C-d> :js liberator.plugins.smooziee.smoothScrollBy(innerHeight / 2)<CR>
noremap <C-u> :js liberator.plugins.smooziee.smoothScrollBy(innerHeight / -2)<CR>
noremap d :js liberator.plugins.smooziee.smoothScrollBy(innerHeight / 2)<CR>
noremap u :js liberator.plugins.smooziee.smoothScrollBy(innerHeight / -2)<CR>
" タブを閉じたとき直前のタブにフォーカスさせる
noremap x <M-W>
noremap X :undo<CR>
no a <Nop>
" A でinstapaperに追加
nmap A :open javascript:function%20iprl5(){var%20d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);d.title='(Saving...)%20'+d.title;z.setAttribute('src',l.protocol+'//www.instapaper.com/j/TbVSmwFP6fKy?a=read-later&u='+encodeURIComponent(l.href)+'&t='+(new%20Date().getTime()));b.appendChild(z);}catch(e){alert('Please%20wait%20until%20the%20page%20has%20loaded.');}}iprl5();void(0)<CR>
" h/lでタブ移動
nmap h <C-p>
nmap l <C-n>
" Ctrl+h/Ctrl+lに戻る/進むを割り当てる
map <C-h> <A-Left>
map <C-l> <A-Right>
" Shift+← / Shift+→でタブ位置変更
map <S-Right> :tabmove! +1<CR>
map <S-Left> :tabmove! -1<CR>
" eでクイックヒントモードを新しいタブで開く
map e F
" 選択文字列でぐぐる(マウスとVISUALモードの選択時に対応)
nmap S <M-c>:tabopen<Space>google<Space><M-v><CR>
vmap S <M-c><Esc><Esc>:tabopen<Space>google<Space><M-v><CR>
" pは文字列によってURLと判断されて誤爆するので明示的にGoogle検索を指定する
nnoremap p :open<Space>google<Space><M-v><CR>
nnoremap P :tabopen<Space>google<Space><M-v><CR>
" undo一覧から開く
nnoremap U :undo<Space>
" タブのピン留めをトグルする
" http://qiita.com/t3kot3ko/items/1b032940dbb79e88323e
javascript <<EOM
liberator.modules.commands.addUserCommand(["togglepin"], "add pin to current tab",
function(){
var currentTab = gBrowser.mCurrentTab
if(currentTab.pinned){
gBrowser.unpinTab(currentTab)
}
else{
gBrowser.pinTab(currentTab)
}
});
EOM
nnoremap <C-t> :togglepin <CR>
" slideshareの操作
nnoremap -urls=www\\.slideshare\\.net <C-k> :slideshare next<CR>
nnoremap -urls=www\\.slideshare\\.net <C-j> :slideshare prev<CR>
nnoremap -urls=ssslide\\.com <C-k> :slideshare next<CR>
nnoremap -urls=ssslide\\.com <C-j> :slideshare prev<CR>
" speakerdeckの操作
" nmap <C-[> :speakerdeck prev<CR>
" nmap <C-]> :speakerdeck next<CR>
nnoremap -urls=speakerdeck\\.com <C-k> :speakerdeck next<CR>
nnoremap -urls=speakerdeck\\.com <C-j> :speakerdeck prev<CR>
" ===========================
" color scheme
" ===========================
" ヒント表示色
highlight Hint z-index:9999; font-size:14px; color: black; text-shadow: rgba(255, 255, 255, 0.6) 0px 1px 0px; line-height: 18px; background: linear-gradient(to bottom, rgb(255, 247, 133), rgb(255, 197, 66)); border-width: 1px; border-style: solid; border-color: rgb(227, 190, 35); border-image: initial; border-radius: 3px;box-shadow: rgba(0, 0, 0, 0.3) 0px 3px 7px 0px; padding: 0 0;min-width: 18px; text-indent: -1px;text-align: center; display: inline-block;position:absolute; text-align: cener; vertical-align: middle; font-weight: bold;font-family: Arial, Menlo, Consolas, Monaco, monospace; text-transform: uppercase; margin-top: --7px; margin-left: -7px;
highlight HintElem background-color:rgba(240,0,0,0.1);
highlight HintActive background:rgba(0,0,240,0.3);
highlight Normal<<EOM
color: #33FF33;
background: #333333;
EOM
highlight StatusLine<<EOM
background: #333333;
color: #33FF33;
font-weight: normal;
EOM
highlight CmdLine<<EOM
transition: all 0.25s;
EOM
highlight ErrorMsg<<EOM
color: white;
background: red;
font-weight: bold;
EOM
highlight WarningMsg<<EOM
color: red;
EOM
highlight CompTitle<<EOM
background: #252525;
EOM
highlight CompTitle>*<<EOM
color: #EEEE55;
text-shadow: 1px 1px 1px #DDDD44;
EOM
" vim: set ft=vimperator:
echo "Finish loading vimperatorrc!"
You can’t perform that action at this time.