Skip to content

Instantly share code, notes, and snippets.

@rcmdnk
Last active January 1, 2024 12:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcmdnk/6f9c3c0f8043391317e1a9cc3e0cafcb to your computer and use it in GitHub Desktop.
Save rcmdnk/6f9c3c0f8043391317e1a9cc3e0cafcb to your computer and use it in GitHub Desktop.
"Settings
"set nohud
"set autohidecursor
"set noinsertmappings
set smoothscroll
set autoupdategist
set noautofocus
"let scrollstep = 30
let fullpagescrollpercent = 90
let blacklists = ['*://*/*.pdf']
let mapleader = ","
"let locale = "jp"
let hintcharacters = "hjklasdfgyuiopqwertnmzxcvb"
let barposition = "top"
let completionengines = []
"let defaultengine = "duckduckgo"
" qmarks
" google
let qmark m = ["https://mail.google.com"]
let qmark t = ["https://mail.google.com/tasks/canvas"]
let qmark c = ["https://www.google.com/calendar"]
let qmark l = ["http://www.google.com/language_tools"]
let qmark k = ["https://keep.google.com"]
let qmark d = ["https://drive.google.com/drive/u/0/my-drive"]
" Feedly/Pocket/GitHub
let qmark f = ["http://cloud.feedly.com/#latest"]
let qmark p = ["http://getpocket.com/a/queue/"]
let qmark g = ["http://github.com/rcmdnk"]
" Move
map <C-h> scrollLeft
map <C-j> scrollDown
map <C-k> scrollUp
map <C-l> scrollRight
map <C-u> scrollPageUp
map <C-d> scrollPageDown
map <C-b> scrollFullPageUp
map <C-f> scrollFullPageDown
" Navigation
map d closeTab
map u lastClosedTab
" <C-n> is originally "Open new window" in Windows and it cannot be mapped from this setting.
" Go to Extensions page, and go Keyboard shortcut, then you can set 'Ctrl+N' to 'Go to the next tab'
" (and 'Ctrl+P' to 'Go to the previous tab'). These settings are valid even in Windows.
" And Keyboard shortcut settings are also valid in new tab or chrome's setting pages, in which extensions' settings are not valid.
" Better to set in Keyboard shortcut than settings here.
map <C-n> nextTab
map <C-p> previousTab
map <C-i> goForward
map <C-o> goBack
map R reloadTabUncached
map w :new<Space>
" Yank current url
map y yankDocumentUrl
" Yank current selected word and search it
map <C-g> :execute vlhyP<CR>
" Open command line with ;
map ; :
" Disable all mappings in Text boxes
"iunmapAll
imap <C-a> beginningOfLine
imap <C-k> deleteToEnd
imap <C-y> deleteWord
imap <C-h> deleteChar
imap <C-d> deleteFowardChar
imap <A-a> selectAll
imap <A-v> editWithVim
" pocket.
" Need to get own bookmarklet from https://getpocket.com/add/?ep=1
" Then, decode bookmarklet with something like http://home.kendomo.net/board/decode/decode2.php
map p :script<Space>javascript:(function(){var e=function(t,n,r,i,s){var o=[5578755,3226513,3196261,1447352,5754625,1900724,9534081,1439849,9043574,4416713];var i=i||0,u=0,n=n||[],r=r||0,s=s||0;var a={'a':97,'b':98,'c':99,'d':100,'e':101,'f':102,'g':103,'h':104,'i':105,'j':106,'k':107,'l':108,'m':109,'n':110,'o':111,'p':112,'q':113,'r':114,'s':115,'t':116,'u':117,'v':118,'w':119,'x':120,'y':121,'z':122,'A':65,'B':66,'C':67,'D':68,'E':69,'F':70,'G':71,'H':72,'I':73,'J':74,'K':75,'L':76,'M':77,'N':78,'O':79,'P':80,'Q':81,'R':82,'S':83,'T':84,'U':85,'V':86,'W':87,'X':88,'Y':89,'Z':90,'0':48,'1':49,'2':50,'3':51,'4':52,'5':53,'6':54,'7':55,'8':56,'9':57,'\/':47,':':58,'?':63,'=':61,'-':45,'_':95,'&':38,'$':36,'!':33,'.':46};if(!s||s==0){t=o[0]+t}for(var f=0;f<t.length;f++){var l=function(e,t){return a[e[t]]?a[e[t]]:e.charCodeAt(t)}(t,f);if(!l*1)l=3;var c=l*(o[i]+l*o[u%o.length]);n[r]=(n[r]?n[r]+c:c)+s+u;var p=c%(50*1);if(n[p]){var d=n[r];n[r]=n[p];n[p]=d}u+=c;r=r==50?0:r+1;i=i==o.length-1?0:i+1}if(s==237){var v='';for(var f=0;f<n.length;f++){v+=String.fromCharCode(n[f]%(25*1)+97)}o=function(){};return v+'9954c60b5a'}else{return e(u+'',n,r,i,s+1)}};var t=document,n=t.location.href,r=t.title;var i=e(n);var s=t.createElement('script');s.type='text/javascript';s.src='https://getpocket.com/b/r4.js?h='+i+'&u='+encodeURIComponent(n)+'&t='+encodeURIComponent(r);e=i=function(){};var o=t.getElementsByTagName('head')[0]||t.documentElement;o.appendChild(s)})()<CR>
" google translator en/ja
map <Leader>e :script<Space>javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com/translate_t?text='+t+'&hl=ja&langpair=auto|en&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+escape(location.href)+'&hl=ja&langpair=auto|en&tbb=1&ie='+e;}<CR>
map <Leader>j :script<Space>javascript:var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com/?text='+t+'&hl=ja&langpair=auto|ja&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&hl=ja&langpair=auto|ja&tbb=1&ie='+e;}<CR>
" hatena
map <Leader>h :script<Space>javascript:void window.open('http://b.hatena.ne.jp/entry/'+location.href)<CR>
" copy current url and title in MarkDown style
copyTitleUrl -> {{
const t = document.title;
const l = location.href;
let ret = '['+t+']('+l+')';
if(l.includes("rcmdnk.com") || l.includes("rcmdnk.github.io") || l.includes("octopress.dev") || l.includes("octopress.test") || l.includes("en.dev") || l.includes("en.test") || l.includes("localhost:3000")){
ret = '{% post_card ' + l.replace(/https?:\/\/(rcmdnk.com|rcmdnk.github.io|octopress.dev|octopress.test|en.dev|en.test|localhost:3000)/,'') + ' ' + t + ' %}';
}
Clipboard.copy(ret);
Status.setMessage(ret, 2);
}}
map <Leader>i :call copyTitleUrl<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment