Skip to content

Instantly share code, notes, and snippets.

@hushin
Last active May 2, 2019 12:19
Show Gist options
  • Save hushin/f1a3d90b9db63026e798a90795733c6b to your computer and use it in GitHub Desktop.
Save hushin/f1a3d90b9db63026e798a90795733c6b to your computer and use it in GitHub Desktop.
set noautofocus
set cncpcompletion
set smoothscroll
let scrollstep = 150
let fullpagescrollpercent = 100
let locale = "jp"
let barposition = "bottom"
let hintcharacters = "hjklasdfgyuiowertnm"
let blacklists = ["https://mail.google.com/*","https://www.google.com/calendar/*","https://www.amazon.co.jp/gp/video/*","https://feedly.com/*","https://i.doit.im/*"]
let previousmatchpattern = "((?!last)((P|p)rev(ious)?|newer|back|«|less|<|‹|←| )+)"
let nextmatchpattern = "((?!first)((N|n)ext|older|more|>|›|»|→|forward| )+)"
" completionengines
let completionengines = ["google"]
" defaultengine
let defaultengine = "google.co.jp"
" searchengine
" duckduckgo
let searchengine duckduckgo = "https://duckduckgo.com/?q=%s"
let searchalias dd = "duckduckgo"
" Google 翻訳 auto>jp
let searchengine ja = "https://translate.google.com/?hl=ja&tab=TT#auto/ja/%s"
let searchalias gj = "ja"
" Google 翻訳 auto>en
let searchengine en = "https://translate.google.com/?hl=ja&tab=TT#auto/en/%s"
let searchalias ge = "en"
" 2ch横断検索 - re.Find2ch
let searchengine refind2ch = "http://refind2ch.org/search?q=%s"
let searchalias 2 = "refind2ch"
" Amazon jp
let searchengine amazon = "https://www.amazon.co.jp/s?k=%s"
let searchalias a = "amazon"
" Chrome ウェブストア
let searchengine webstore = "https://chrome.google.com/webstore/search?q=%s"
let searchalias cw = "webstore"
" Yahoo!リアルタイム検索
let searchengine realtime = "http://realtime.search.yahoo.co.jp/search?ei=UTF-8&p=%s"
let searchalias rt = "realtime"
" youtube
let searchengine youtubes = "https://www.youtube.com/results?search_query=%s"
let searchalias y = "youtubes"
" Wikipedia jp
let searchengine wiki = "https://ja.wikipedia.org/wiki/%s"
let searchalias w = "wiki"
" hatena tag
let searchengine hatena = "http://b.hatena.ne.jp/search/tag?q=%s"
let searchalias ht = "hatena"
" niconico
let searchengine nico = "http://www.nicovideo.jp/search/%s"
let searchalias n = "nico"
"niconico dictionary
let searchengine nicod = "http://dic.nicovideo.jp/s/al/a/%s"
let searchalias nd = "nicod"
" Github
let searchengine github = "https://github.com/search?q=%s"
let searchalias gi = "github"
" Twitter
let searchengine twitter = "https://twitter.com/search?q=%s"
let searchalias tw = "twitter"
" Twitter follows
let searchengine twitter_follows = "https://twitter.com/search?s=follows&vertical=default&q=%s%20OR%20%40dummyaccount"
let searchalias tf = "twitter_follows"
" qmark
" gn* で新しいタブで設定したページを開く
" go* で既存のタブに設定したページを開く
let qmark m = ["http://b.hatena.ne.jp/hush_in/hotentry"]
let qmark s =["chrome://settings/"]
let qmark x = ["chrome://extensions/"]
let qmark i = ["https://www.instapaper.com/u"]
" Tab Navigation
map h previousTab
map l nextTab
map ga firstTab
map ge lastTab
"新しいタブで開くヒントモード
map e createActiveTabbedHint
"戻る、進む
map <C-h> goBack
map <C-l> goForward
" s でぐぐる
map s :tabnew google<SPACE>
"S で選択した文字を検索する
map S :execute vyP<CR>
" インサートモード
unmap i
" D で URLの query string を削除
map D :script location.href = location.href.replace(/\?.*/,'')<CR>
" A でinstapaperに追加
map A :script function iprl5(){var d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);d.title='(Saving...) '+d.title;z.setAttribute('src',l.protocol+'//www.instapaper.com/j/TbVSmwFP6fKy?a=read-later&u='+encodeURIComponent(l.href)+'&t='+(new Date().getTime()));b.appendChild(z);}catch(e){alert('Please wait until the page has loaded.');}}iprl5();void(0)<CR>
" 他
unmap p
map gb :buffer<Space>
map <C-t> :togglepin<CR>
" Clipboard Copy
copyText (text) -> {{
Clipboard.copy(text);
Status.setMessage('copied: ' + text, 2);
}}
copyUrl (format) -> {{
let text = format.replace("%URL%", location.href).replace("%TITLE%", document.title);
Clipboard.copy(text);
Status.setMessage('copied: ' + text, 2);
}}
copyHtmlLink () -> {{
var clipNode = document.createElement('a');
var range = range = document.createRange();
var sel = window.getSelection();
clipNode.setAttribute('href', location.href);
clipNode.innerText = document.title;
document.body.appendChild(clipNode);
range.selectNode(clipNode);
sel.removeAllRanges();
sel.addRange(range);
document.execCommand('copy', false, null);
document.body.removeChild(clipNode);
Status.setMessage('copyHTMLLinkToClipboard',2);
}}
" copy markdown link
map cm :call copyText('['+document.title.replace(/([|\[\]])/g,'\\$1')+']'+'('+location.href+')')<CR>
" copy org link
map co :call copyText('[['+location.href+']['+document.title.replace(/([\[\]])/g,' ')+']]')<CR>
" copy textile link
map ct :call copyUrl('"%TITLE%":%URL%')<CR>
" copy title and url
map cu :call copyUrl("%TITLE% / %URL%")<CR>
" copy scrapbox link
map cs :call copyUrl('[%TITLE% %URL%]')<CR>
" copy href link
map ca :call copyUrl('<a href="%URL%">%TITLE%</a>')<CR>
" copy html link
map cc :call copyHtmlLink()<CR>
" Site-specific Configuration
site 'https://mail.google.com/*' {
set numerichints
unmap j k gi o ? s y e m r a zi zo z0 z / [[ ]]
}
site 'https://speakerdeck.com/*' {
unmap h l
map l :script document.querySelector('.speakerdeck-iframe').contentWindow.document.querySelector('.sd-player-next').click()<CR>
map h :script document.querySelector('.speakerdeck-iframe').contentWindow.document.querySelector('.sd-player-previous').click()<CR>
}
site 'https://www.slideshare.net/*' {
unmap h l
map l :script document.querySelector('.j-next-btn').click()<CR>
map h :script document.querySelector('.j-prev-btn').click()<CR>
}
site 'https://booklog.jp/*' {
map R :script window.open(`https://read.amazon.co.jp/?asin=${document.querySelector('.item-area-info-title a').getAttribute('href').replace(/.*\//, '')}`)<CR>
}
" Text boxes
iunmapAll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment