Skip to content

Instantly share code, notes, and snippets.

@Jagua
Last active December 17, 2015 18:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jagua/5653116 to your computer and use it in GitHub Desktop.
Save Jagua/5653116 to your computer and use it in GitHub Desktop.
support commands for reading now and/or later on Vimperator.
" Evernote Clearly: Clipper: Clip: " {{{
" Evernote Clearly :: Add-ons for Firefox
" https://addons.mozilla.org/ja/firefox/addon/clearly/
" Evernote Web Clipper :: Add-ons for Firefox
" https://addons.mozilla.org/ja/firefox/addon/evernote-web-clipper/
" Clearly (toggle)
nnoremap e :<C-u>js __readable_by_evernote.__readable_by_evernote__launch(false)<CR>
" Clip to Evernote
nnoremap E :<C-u>js __readable_by_evernote.__readable_by_evernote__launch(true)<CR>
nmap <Leader>ea E
" }}}
" Instapaper: (simple version) " {{{
nnoremap <Leader>ia :<C-u>instapaper<CR>
let g:instapaper_username = 'USERNAME'
let g:instapaper_password = 'PASSWORD'
js << EOM
// require: _libly.js
commands.addUserCommand(
['instapaper'],
'add pages to Instapaper',
function (args) {
function toQuery(qs) {
return [i + '=' + encodeURIComponent(qs[i])
for (i in qs)
].join('&');
}
var req = new plugins.libly.Request(
'https://www.instapaper.com/api/add',
{
},
{
postBody: toQuery({
username: liberator.globalVariables.instapaper_username,
password: liberator.globalVariables.instapaper_password,
url: buffer.URL,
})
}
);
req.addEventListener('success', function(data) {
liberator.echo('This URL has been successfully added to your Instapaper account.');
});
req.addEventListener('failure', function(data) {
liberator.echoerr(data.statusText);
liberator.echoerr(data.responseText);
//liberator.echoerr('This URL has failed to add to your Instapaper account.');
});
req.addEventListener('exception', function(data) {
liberator.echoerr(data.statusText);
liberator.echoerr(data.responseText);
//liberator.echoerr('This URL has failed to add to your Instapaper account.');
});
req.post();
},{
literal: 0,
},
true
);
EOM
" }}}
" Readability: " {{{
" Readability :: Add-ons for Firefox
" https://addons.mozilla.org/ja/firefox/addon/readability/
" read immediately
nnoremap <Leader>ra :<C-u>js rdb.firefox.overlay.read_now()<CR>
" read later
nnoremap <Leader>rl :<C-u>js rdb.firefox.overlay.read_later()<CR>
" send to kindle
nnoremap <Leader>rk :<C-u>js rdb.firefox.overlay.send_to_kindle()<CR>
" }}}
" CSS on/off (toggle): css: " {{{
nnoremap ! :<C-u>set invum<CR>
" }}}
@eoinoc
Copy link

eoinoc commented Jul 5, 2013

Nice share. Do you type in :rk to send to your Kindle?

It's not working for me with the combinations I'm trying. But simply :js rdb.firefox.overlay.send_to_kindle() does work.

@Jagua
Copy link
Author

Jagua commented Jan 11, 2014

@eoinoc In the case of <Leader>rk, you should type not :rk but \rk by default. (cf. :help <Leader>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment