From 557b9c95c6f24b2060b2b8dc338dea05c3e59528 Mon Sep 17 00:00:00 2001 From: Wenxuan Date: Sat, 14 Apr 2018 10:46:18 +0800 Subject: Add support for www domains without 'http' prefix --- fzf-url.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fzf-url.sh b/fzf-url.sh index 48dcc45..04a6060 100755 --- a/fzf-url.sh +++ b/fzf-url.sh @@ -17,6 +17,7 @@ fi content="$(tmux capture-pane -J -p)" urls=($(echo "$content" |grep -oE '\b(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]')) +wwws=($(echo "$content" |grep -oE 'www(\.[^\.]+)+' | sed 's/\(.*\)/http:\/\/\1/')) ips=($(echo "$content" |grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(:[0-9].*)?' | sed 's/\(.*\)/http:\/\/\1/')) merge() { @@ -25,7 +26,7 @@ merge() { done } -merge "${urls[@]}" "${ips[@]}" | +merge "${urls[@]}" "${wwws[@]}" "${ips[@]}"| sort -u | nl -w3 -s ' ' | fzf_cmd | -- cgit v1.2.3