From 3fbd060c7beacf4b3f046e8c18f253fc783db87b Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Fri, 22 Jul 2011 22:03:36 +0200 Subject: [PATCH] zsh: complete from screen and tmux, workaround screen --- etc/zsh/zshrc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index cf20ca7..a92ffb5 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1017,8 +1017,8 @@ zstyle ':completion:hist-complete:*' completer _history #k# complete word from history with menu bindkey "^X^X" hist-complete -## complete word from currently visible SCREEN buffer. -if check_com -c screen ; then +## complete word from currently visible Screen or Tmux buffer. +if check_com -c screen || check_com -c tmux; then _complete_screen_display() { [[ "$TERM" != "screen" ]] && return 1 @@ -1026,8 +1026,15 @@ if check_com -c screen ; then local -U -a _screen_display_wordlist trap "rm -f $TMPFILE" EXIT - screen -X hardcopy $TMPFILE # fill array with contents from screen hardcopy + if ((${+TMUX})); then + #works, but crashes tmux below version 1.4 + tmux -q capture-pane \; save-buffer -b 0 $TMPFILE \; delete-buffer -b 0 + else + screen -X hardcopy $TMPFILE + #screen sucks, it dumps in latin1, apparently always. so recode it to system charset + check_com recode && recode latin1 $TMPFILE + fi _screen_display_wordlist=( ${(QQ)$(<$TMPFILE)} ) # remove PREFIX to be completed from that array _screen_display_wordlist[${_screen_display_wordlist[(i)$PREFIX]}]="" -- 2.1.4