mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
add google function
This commit is contained in:
parent
500e5a73b6
commit
d9c0892b5a
1 changed files with 19 additions and 0 deletions
|
|
@ -191,3 +191,22 @@ function itunes() {
|
|||
osascript -e "tell application \"iTunes\" to $opt"
|
||||
}
|
||||
|
||||
# enable google search from terminal
|
||||
function google() {
|
||||
local url="https://www.google.com/search?hl=en#newwindow=1&q="
|
||||
case "$1" in
|
||||
"" | -h | --help)
|
||||
cat << EOH
|
||||
google:
|
||||
google "keyword" to search
|
||||
EOH
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
while [ $# -ge 1 ]; do
|
||||
open "$url"$(echo ${1// /+} | xxd -plain | sed 's/\(..\)/%\1/g')
|
||||
shift
|
||||
done
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue