X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=1827e6b823f57afda64552230d681aacb15523d0;hb=8cd07c97d3060a4360418345e43bd5264ce68e15;hp=399ac4f0e52309e3863e0c87cdbb794fa258d894;hpb=5dd23e2f094bfa37e5555583607f9698752487f7;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 399ac4f..1827e6b 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1013,6 +1013,27 @@ 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_screen_display() { + [[ "$TERM" != "screen" ]] && return 1 + + local TMPFILE=$(mktemp) + local -U -a _screen_display_wordlist + trap "rm -f $TMPFILE" EXIT + + screen -X hardcopy $TMPFILE + # fill array with contents from screen hardcopy + _screen_display_wordlist=( ${(QQ)$(<$TMPFILE)} ) + # remove PREFIX to be completed from that array + _screen_display_wordlist[${_screen_display_wordlist[(i)$PREFIX]}]="" + compadd -a _screen_display_wordlist + } + #k# complete word from currently visible GNU screen buffer + bindkey -r "^XS" + compdef -k _complete_screen_display complete-word '^XS' +fi + # }}} # {{{ history @@ -3650,6 +3671,13 @@ if is439 && [[ -d /dev/disk/by-id/ ]]; then } fi +#f5# run command or function in a list of directories +rundirs() { + local d CMD STARTDIR=$PWD + CMD=$1; shift + ( for d ($@) {cd -q $d && { print cd $d; ${(z)CMD} ; cd -q $STARTDIR }} ) +} + # Translate DE<=>EN # 'translate' looks up fot a word in a file with language-to-language # translations (field separator should be " : "). A typical wordlist looks