I've been trying to use Duck Duck Go as my primary search engine, but sometimes Google's results are better. So, what happens is that I'll first search for foo on DDG...
:open foo ->
https://duckduckgo.com/?q=foo
...and then I'll redo the same search on Google, usually by pressing :<C-p> to go back to my previous command, then moving leftward until my cursor is before foo, and then adding the DDG bang !g...
:open !g foo ->
https://encrypted.google.com/search?hl=en&q=foo
...which is rather tedious.
Question: Is there an easy way to automate this process --- either with a keybinding/command that adds !g to the previous command, or with a keybinding /command that adds !g to the DDG URL (in the right spot, of course)?
I know that I can edit-url manually with my editor, but is there some way of automatically transforming
https://duckduckgo.com/?q=foo
into
https://duckduckgo.com/?q=!g+foo
? (Note that appending !g to the very end of the URL is not a general solution because DDG often adds extra stuff like &xy=bar).
You can write an userscript which reads $QUTE_URL, does whatever you want with it, and then writes :open $new_url to $QUTE_FIFO.
Amazing! This simple bash script seems to do the trick:
#!/bin/bash
new_url=$(echo "${QUTE_URL}" | sed 's/?q=/?q=!g+/')
echo "open ${new_url}" >> "${QUTE_FIFO}"
Thanks!
Hats off to Sir Compiler for making this possible!
On Feb 23, 2017 2:32 PM, "Brian Buccola" notifications@github.com wrote:
Amazing! This simple bash script seems to do the trick:
!/bin/bash
new_url=$(echo "${QUTE_URL}" | sed 's/?q=/?q=!g+/')
echo "open ${new_url}" >> "${QUTE_FIFO}"
Thanks!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/qutebrowser/qutebrowser/issues/2346#issuecomment-282095730,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATT4eVyWgoBGvEZ3eBsEyb1q5JVvOKyqks5rfd62gaJpZM4MKYET
.
Most helpful comment
Amazing! This simple bash script seems to do the trick:
Thanks!