diff options
author | Igor Epstein <igorepst@gmail.com> | 2019-04-03 20:44:13 +0300 |
---|---|---|
committer | Igor Epstein <igorepst@gmail.com> | 2019-04-03 20:44:13 +0300 |
commit | f3f7d27f109f991f7f86155678c036097898ce57 (patch) | |
tree | b12aee4045eea87cdbae82c65801bdb1c495cc6d | |
parent | 02ab9d97cf201618eb2f62504aaf13c1f366fee6 (diff) | |
download | fork-tmux-fzf-url-f3f7d27f109f991f7f86155678c036097898ce57.tar.gz fork-tmux-fzf-url-f3f7d27f109f991f7f86155678c036097898ce57.tar.bz2 fork-tmux-fzf-url-f3f7d27f109f991f7f86155678c036097898ce57.zip |
Add Git SSH URLs
-rwxr-xr-x | fzf-url.sh | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -6,7 +6,7 @@ #=============================================================================== fzf_cmd() { - fzf-tmux -d 35% --multi --exit-0 --cycle --reverse --bind='ctrl-r:toggle-all' --bind='ctrl-s:toggle-sort' + fzf-tmux -d 35% --multi --exit-0 --cycle --reverse --bind='ctrl-r:toggle-all' --bind='ctrl-s:toggle-sort' --no-preview } if hash xdg-open &>/dev/null; then @@ -19,6 +19,7 @@ content="$(tmux capture-pane -J -p)" 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/')) merge() { for item in "$@" ; do @@ -26,7 +27,7 @@ merge() { done } -merge "${urls[@]}" "${wwws[@]}" "${ips[@]}"| +merge "${urls[@]}" "${wwws[@]}" "${ips[@]}" "${gits[@]}"| sort -u | nl -w3 -s ' ' | fzf_cmd | |