Skip to content

Instantly share code, notes, and snippets.

@m040601
Last active January 12, 2016 04:09
Show Gist options
  • Select an option

  • Save m040601/99d0e999f69c1091479c to your computer and use it in GitHub Desktop.

Select an option

Save m040601/99d0e999f69c1091479c to your computer and use it in GitHub Desktop.
" hello world
" Open all of these in a tab with `gnb` or open one of these with <N>goa where <N>
let qmark a = ["http://www.reddit.com", "http://www.liliputing.com"]
" https://developer.chrome.com/extensions/match_patterns
" *://mail.google.com/* , Matches any URL that starts with http://mail.google.com or https://mail.google.com.
" let blacklists = ["https://mail.google.com/*", "*://mail.google.com/*", "@https://mail.google.com/mail/*"]
" blacklists prefixed by '@' act as a whitelist
"let blacklists = ["@//google.com/*"]
"let blacklists = ["@//*.google.com/*"]
"let blacklists = ["@*://*.reddit.com/*"]
let blacklists = ["@*.//*.google.com/*","@chrome://*"]
" You can add domain-specific blacklists via the
"blacklists variable. For example, if you were to map the <Down> key
"to scrollDown instead of Chrome's native scroll down shortcut, the binding wouldn't
"work in Chrome's PDF viewer because JavaScript can't control PDF scroll. To use Chrome's native scroll down shortcut on only PDF files (and cVim's on non-PDF files), you would add this line to your cVimrc:
"let blacklists = ["*://*/*.pdf <Down>"]
" Excellent thanks! So for gmail one might have something like this?
" let blacklists = ["https://mail.google.com/* gi gt x r f"]
" Yep, that would disable keys gi, gt, x, r, and f on gmail.
" This seems to be working fine with single letters like x, j, and k, but not for double letter commands like gi or gt. It does seem to disable the cVim functionality - gi does not focus on the input box, for example - but neither does it execute the gmail command. Any thoughts on that one?
" As of now, there isn't really any way of allowing multi-key events to be interpreted by cVim and gmail at the same time. For example, even if cVim doesn't have a gi binding, it still has to make sure you're not pressing another g<KEY> binding like gs (goToSource) before it can ignore the binding. The solution to this would be to wait for the binding cVim doesn't have (gi) and send the key sequence to gmail's script file to be interpreted once cVim determines you aren't going to press one of its other g<KEY> bindings. I researched this a little, but it looks like I won't be able to add this feature until Webkit fixes a really old bug (https://bugs.webkit.org/show_bug.cgi?id=16735).
" For now, you can just enter insert mode (i) to allow cVim to pass the keys through to gmail, then press <Esc> once you're done. So the sequence of keys would be: igi<Esc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment