diff options
| author | Wenxuan Zhang <wenxuangm@gmail.com> | 2021-05-30 17:11:08 +0800 | 
|---|---|---|
| committer | Wenxuan Zhang <wenxuangm@gmail.com> | 2021-05-30 17:11:08 +0800 | 
| commit | f338301bd6de59efae91746e5bbac4b0c09a1639 (patch) | |
| tree | 41d1e379eecd282f6d83510f5650cf5b1d32e62e | |
| parent | 6f0a08ad6e5eeed55cefea60ae1015e1bd796720 (diff) | |
| download | fork-tmux-fzf-url-f338301bd6de59efae91746e5bbac4b0c09a1639.tar.gz fork-tmux-fzf-url-f338301bd6de59efae91746e5bbac4b0c09a1639.tar.bz2 fork-tmux-fzf-url-f338301bd6de59efae91746e5bbac4b0c09a1639.zip | |
refactor: option name and default behavior (#14)
| -rwxr-xr-x | fzf-url.sh | 10 | ||||
| -rwxr-xr-x | fzf-url.tmux | 4 | 
2 files changed, 11 insertions, 3 deletions
| @@ -19,7 +19,15 @@ open_url() {      fi  } -content="$(tmux capture-pane -J -p -S -"$2")" + +limit='screen' +[[ $# -ge 2 ]] && limit=$2 + +if [[ $limit == 'screen' ]]; then +    content="$(tmux capture-pane -J -p)" +else +    content="$(tmux capture-pane -J -p -S -"$limit")" +fi  mapfile -t urls < <(echo "$content" |grep -oE '(https?|ftp|file):/?//[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]')  mapfile -t wwws < <(echo "$content" |grep -oE 'www\.[a-zA-Z](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}(/\S+)*'                  |sed 's/^\(.*\)$/http:\/\/\1/') diff --git a/fzf-url.tmux b/fzf-url.tmux index 3f5d166..7c505db 100755 --- a/fzf-url.tmux +++ b/fzf-url.tmux @@ -15,8 +15,8 @@ tmux_get() {  }  key="$(tmux_get '@fzf-url-bind' 'u')" -historyLimit="$(tmux_get 'history-limit' '2000')" +history_limit="$(tmux_get '@fzf-url-history-limit' 'screen')"  extra_filter="$(tmux_get '@fzf-url-extra-filter' '')"  echo "$extra_filter" > /tmp/filter -tmux bind-key "$key" run -b "$SCRIPT_DIR/fzf-url.sh '$extra_filter' '$historyLimit'"; +tmux bind-key "$key" run -b "$SCRIPT_DIR/fzf-url.sh '$extra_filter' $history_limit"; | 
