aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenxuan Zhang <wenxuangm@gmail.com>2019-04-08 12:06:05 +0800
committerWenxuan Zhang <wenxuangm@gmail.com>2019-04-08 12:06:05 +0800
commit26aadc67924381ba63db8530f4c1cb4fe3126cfb (patch)
treedb1f9f71bb7b3529bb0753945810622ba5fb5532
parent227bf8bb1010f43be61f8da0f74fedb555b6817a (diff)
downloadfork-tmux-fzf-url-26aadc67924381ba63db8530f4c1cb4fe3126cfb.tar.gz
fork-tmux-fzf-url-26aadc67924381ba63db8530f4c1cb4fe3126cfb.tar.bz2
fork-tmux-fzf-url-26aadc67924381ba63db8530f4c1cb4fe3126cfb.zip
Support url patterns like 'file:///'
-rwxr-xr-xfzf-url.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/fzf-url.sh b/fzf-url.sh
index 0c3383d..37ad3c3 100755
--- a/fzf-url.sh
+++ b/fzf-url.sh
@@ -16,7 +16,7 @@ elif hash open &>/dev/null; then
fi
content="$(tmux capture-pane -J -p)"
-urls=($(echo "$content" |grep -oE '(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]'))
+urls=($(echo "$content" |grep -oE '(https?|ftp|file):/?//[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]'))
wwws=($(echo "$content" |grep -oE 'www\.[a-zA-Z](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}(/\S+)*' |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]{1,5})?(/\S+)*' |sed 's/^\(.*\)$/http:\/\/\1/'))
gits=($(echo "$content" |grep -oE '(ssh://)?git@\S*' | sed 's/:/\//g' | sed 's/^\(ssh\/\/\/\)\{0,1\}git@\(.*\)$/https:\/\/\2/'))