Skip to content

Search with DuckDuckGo

David-Apps edited this page Mar 23, 2024 · 10 revisions

These functions make it easier to search with DuckDuckGo. The functions move to the first search result and stop. To move to the next search result, you can use the / command.

# Search using DuckDuckGo.
# usage: <ddg <search terms>
function:ddg {
db0
H-
sw+
enew
nostack b https://lite.duckduckgo.com/lite/
/<>/f i1=~0
i2*
/^\d+\. /
}

# Search for the contents of the current line using DuckDuckGo.
# usage: <lddg [<extra keywords>]
function:lddg {
db0
H-
sw+
enew
nostack b https://lite.duckduckgo.com/lite/
/<>/f i1<+1@.
s/$/ ~0/f
s/ *$//f
i2*
/^\d+\. /
}