aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenxuan <wenxuangm@gmail.com>2018-04-14 10:46:18 +0800
committerWenxuan <wenxuangm@gmail.com>2018-04-14 10:46:18 +0800
commit557b9c95c6f24b2060b2b8dc338dea05c3e59528 (patch)
tree25e13063fb4f98f92d3a06f2550a36704149ecac
parent6121243ca3439e89c1c6adc66dd09a1ea7383ad4 (diff)
downloadfork-tmux-fzf-url-557b9c95c6f24b2060b2b8dc338dea05c3e59528.tar.gz
fork-tmux-fzf-url-557b9c95c6f24b2060b2b8dc338dea05c3e59528.tar.bz2
fork-tmux-fzf-url-557b9c95c6f24b2060b2b8dc338dea05c3e59528.zip
Add support for www domains without 'http' prefix
-rwxr-xr-xfzf-url.sh3
1 files changed, 2 insertions, 1 deletions
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 |