diff options
author | Wenxuan <wenxuangm@gmail.com> | 2018-04-14 10:46:18 +0800 |
---|---|---|
committer | Wenxuan <wenxuangm@gmail.com> | 2018-04-14 10:46:18 +0800 |
commit | 557b9c95c6f24b2060b2b8dc338dea05c3e59528 (patch) | |
tree | 25e13063fb4f98f92d3a06f2550a36704149ecac | |
parent | 6121243ca3439e89c1c6adc66dd09a1ea7383ad4 (diff) | |
download | fork-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-x | fzf-url.sh | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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 | |