Skip to content

Instantly share code, notes, and snippets.

@malanjp
Created January 16, 2018 05:49
Show Gist options
  • Save malanjp/c69906c0c5906de046be609263c679a1 to your computer and use it in GitHub Desktop.
Save malanjp/c69906c0c5906de046be609263c679a1 to your computer and use it in GitHub Desktop.
cvim
"Settings
" Check Gist automatically and update settings
set autoupdategist
" Do not focus an input field when a page is loaded
set noautofocus
" Key of <Leader> (Default: "\")
let mapleader = ","
" Characters for Hit-a-Hint (Default: "asdfgqwertzxcvb")
let hintcharacters = "hjklasdfgyuiopqwertnmzxcvb"
" qmarks
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 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
map <C-p> previousTab
" <C-n> is originally "Open new window" in Windows and it cannot be mapped.
" Use <A-n> and swap <C-n> <-> <A-n> by such AutoHotkey.aa
map <C-n> nextTab
map <A-n> nextTab
map <C-i> goForward
map <C-o> goBack
map R reloadTabUncached
" Yank current url
map y yankDocumentUrl
" Yank current selected word and search it
map <C-g> :execute vP<CR>
" Open command line with ;
map ; :
" Disable all mappings in Text boxes
iunmapAll
" pocket.
" Need to get own bookmarklet from https://getpocket.com/add/?ep=1
" If bookmarklet is encoded, need to decode it with something like http://home.kendomo.net/board/decode/decode2.php
map <Leader>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>
" 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("octopress.dev") || l.includes("en.dev")){
ret = '{{
const t = document.title;
const l = location.href;
let ret = '['+t+']('+l+')';
if(l.includes("rcmdnk.com") || l.includes("octopress.dev") || l.includes("en.dev")){
ret = '{% post_card ' + l.replace(/https?:\/\/(rcmdnk.com|octopress.dev|en.dev)/,'') + ' ' + 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