diff options
author | Adrian Kummerlaender | 2016-03-06 22:20:39 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2016-03-06 22:20:39 +0100 |
commit | 9528a454b425fb8d06cd66194eb823b7ab4745b1 (patch) | |
tree | db57df37394b62522438b1813df93a5baca1755f | |
parent | 71870cceb43de26481ef35bfd5cc3bf41ce270f6 (diff) | |
download | dotfiles-9528a454b425fb8d06cd66194eb823b7ab4745b1.tar dotfiles-9528a454b425fb8d06cd66194eb823b7ab4745b1.tar.gz dotfiles-9528a454b425fb8d06cd66194eb823b7ab4745b1.tar.bz2 dotfiles-9528a454b425fb8d06cd66194eb823b7ab4745b1.tar.lz dotfiles-9528a454b425fb8d06cd66194eb823b7ab4745b1.tar.xz dotfiles-9528a454b425fb8d06cd66194eb823b7ab4745b1.tar.zst dotfiles-9528a454b425fb8d06cd66194eb823b7ab4745b1.zip |
Implement custom bookmarking command
-rw-r--r-- | pentadactyl/.pentadactylrc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/pentadactyl/.pentadactylrc b/pentadactyl/.pentadactylrc index a227d71..7826648 100644 --- a/pentadactyl/.pentadactylrc +++ b/pentadactyl/.pentadactylrc @@ -35,9 +35,27 @@ hi HintActive command! reader -js <<EOF if ( buffer.URL.spec.startsWith('about:reader?') ) { - dactyl.execute('back') + dactyl.execute('back') } else { - dactyl.open('about:reader?url=' + encodeURIComponent(buffer.URL.spec)) + dactyl.open('about:reader?url=' + encodeURIComponent(buffer.URL.spec)) } EOF map -builtin -ex <F9> :reader + +command! push2inbox -js <<EOF +function escape(msg) { + return msg.replace(/([^a-zA-Z0-9_])/g, "\\$1"); +} + +var selection = content.getSelection().toString(); +var entry = '\\* ' + escape(buffer.URL); + +if ( selection ) { + entry += '\\n\\t\\* ' + escape(selection); +} else if ( content.document.title ) { + entry += '\\n\\t\\* ' + escape(content.document.title); +} + +dactyl.execute('!echo ' + entry + ' >> ~/note/src/web/inbox.wiki'); +EOF +nmap b :push2inbox<CR> |