summaryrefslogtreecommitdiff
path: root/tmuxsh/_surfraw,--.search.the.internet
blob: d2de789b3c747d66536be164260cef71be90b378 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env sh
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
#         https://www.youtube.com/user/gotbletu
# DESC:   search internet from a list of search engines
# REQD:   set a default terminal web browser
#           $EDITOR ~/.bashrc
#             export BROWSERCLI=w3m

PREFIX=$(surfraw -elvi | grep -v 'LOCAL\|GLOBAL' | fzf -e -i -m --prompt='Select search engine(s): ' --info=default --layout=reverse --tiebreak=index | awk '{print $1}')
[ -z "$PREFIX" ] && exit
ENGINES=$(echo "$PREFIX" | tr '\n' ' ')
INPUT=$(echo | fzf --print-query --prompt="Enter keyword(s) to search ${ENGINES}: " --info=default --layout=reverse)
[ -z "$INPUT" ] && exit
echo "$PREFIX" | while read -r line; do
  tmux new-window -n "sr-${line}" "$BROWSERCLI '"$(surfraw -p $line $INPUT)"'"
done