Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __get_tmux_pane_contents() {
- local cmd='for pane in `tmux list-panes -F "#{pane_id}"`; do tmux capture-pane -p -t $pane; done'
- for word in `eval "$cmd"`; do
- if [ ${#word} -ge ${FZF_MIN_WORD_LENGTH:-4} ]; then
- echo "$word"
- fi
- done | awk '{ print length, $0 }' | sort -rn | cut -d' ' -f2- | uniq
- }
- __tmux_pane_sel() {
- setopt localoptions pipefail 2> /dev/null
- __get_tmux_pane_contents | FZF_DEFAUL_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS" $(__fzfcmd) -m "$@"
- local ret=$?
- echo
- return $ret
- }
- fzf-complete-pane-widget() {
- LBUFFER="${LBUFFER}$(__tmux_pane_sel)"
- local ret="$?"
- zle redisplay
- typeset -f zle-line-init >/dev/null && zle zle-line-init
- return $ret
- }
- zle -N fzf-complete-pane-widget
- bindkey '^X^A' fzf-complete-pane-widget
Add Comment
Please, Sign In to add comment