Add bin/duckduckgo & ddg alias
This commit is contained in:
parent
2bc05af687
commit
216d1d5ec9
16
bin/duckduckgo
Executable file
16
bin/duckduckgo
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
urlencode() {
|
||||
local LANG=C
|
||||
for ((i=0;i<${#1};i++)); do
|
||||
if [[ ${1:$i:1} =~ ^[a-zA-Z0-9\.\~\_\-]$ ]]; then
|
||||
printf "${1:$i:1}"
|
||||
else
|
||||
printf '%%%02X' "'${1:$i:1}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
query=$(urlencode "$*")
|
||||
echo "Opening https://duckduckgo.com/?q=$query"
|
||||
open "https://duckduckgo.com/?q=$query"
|
|
@ -6,6 +6,8 @@ autoload -U zmv
|
|||
zman() { PAGER="less -g -s '+/^ "$1"'" man zshall; }
|
||||
alias ag='noglob ag'
|
||||
|
||||
alias ddg='duckduckgo'
|
||||
|
||||
# Canonical hex dump; some systems have this symlinked
|
||||
is-callable hd || alias hd="hexdump -C"
|
||||
|
||||
|
|
Loading…
Reference in a new issue